#How to calculate sqrt(float)
23 messages · Page 1 of 1 (latest)
how precise do you want it to be?
i derived one funny algorithm but its mostly just for a pen & paper calculation
just so that you can approximate the number
for anything actually precise you probably want more advanced existing methods
and maybe a couple of newton's method to improve the result
(yes, im still proud of my approximation)
let me write it on python to show how it
and it can also be written somewhat fast because float bit manipulation
it gets worse tho for larger and larger numbers
you might think 0.03 away isnt that bad
but it is
As precise as floating points allow