Floating point library routines hang when converting to integer
Phil Pilgrim (PhiPi)
Posts: 23,514
I've discovered that the ftrunc and fround routines in Float32, Float32A, and Float32Full hang when the argument is out-of-bounds for an integer. Here's my test code:
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ ser: "Parallax Serial Terminal" flt: "Float32" PUB start | fp_number fp_number := $dd4495b3 ser.start(9600) ser.str(string("Start.", 13)) ser.dec(flt.ftrunc(fp_number)) ser.str(string(13,"Done."))
BTW, the Spin version, FloatMath, does okay: it just returns zero for arguments that are out-of-bounds.
-Phil
Comments
Phil, can you please post the "Float32" object here?
I believe this was the latest version (1.6)
Attached is the one I have -- same as Mike's: v.1.6.
-Phil