Square root
Jonathan Holle
Posts: 48
How to calculate the square root of a variable without truncation and with floating point ?
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