Closed GoogleCodeExporter closed 9 years ago
That's my fault, I translated a floating point algorithm from somewhere into
fixed point and never tested it, if I get time then I may re-write the
algorithm but if you're feeling brave then your best bet is to google for an
algorithm and implement it (and then add it to the SDK of-course :) ).
Original comment by Flatmush@googlemail.com
on 17 Jun 2010 at 12:48
Hmm, I've tested it and the library is correct, your use of it is wrong.
This library does maths as fixed point 16.16 (look up Q number format on
wikipedia).
sqrt(980) actually works out the sqrt of (980 / 65536) which is
0.01495361328125.
This equates to 0.12228496751951974902237668500874 which when multiplied by
65536 is 8014.
If you want to use this library just for integer square roots then you can do:
fix_to_int(fix16_sqrt(fix16_from_int(980)))
Which would actually return 31 as you expect.
Original comment by Flatmush@googlemail.com
on 17 Jun 2010 at 1:59
Oh! Thanks, my fault. Sorry for bothering.
Original comment by nzeemin
on 17 Jun 2010 at 2:53
Original comment by Flatmush@googlemail.com
on 17 Jun 2010 at 3:52
Original issue reported on code.google.com by
nzeemin
on 14 Jun 2010 at 1:34