Theres several float objects that support sqr, they store a float in 32bits so its not without truncation, they store a float as 1bit sign, 7bits mantissa, 24bits exponent so you can work out the accuracy of the float, its called single precision IEEE-754.
Comments
here is my code :
OBJ
debug : "Fullduplexserial"
f : "Float32Full"
fstr : "floatstring"
...
Pub Main | a, x, y
Debug.start(31, 30, 0, 57600)
f.start
pxa3 := fstr.floattoformat(f.cos(30), 5, 3)
DEBUG.str(string("test :"))
DEBUG.str(pxa3)
It debug 1.00 ...
To put a constant in float format you need a . i.e. 30 is 30.0 otherwise you can use f.ffloat to convert e.g
is the equivalent
·
pxa3 := fstr.floattoformat(f.cos(40.0), 6, 3)
DEBUG.str(string("test :"))
DEBUG.str(pxa3)
I got pxa3 = -0,667
John Abshier