Float To String Problem
Blitz3D Forums/Blitz3D Programming/Float To String Problem
| ||
I need to write a file with strings that represent floats. This is easy if i make: Writefile f,Str(12.45) (I know i can use it without the str function) But if i make this v# = 0.00001 writefile f,v The string is 1.e-005 But blitz doesn't recognize 1.e-005 as a float number, and i need to write a file that can be compilable under blitz. Any help? |
| ||
That's due to floating point inaccuracy. Why do you need to convert them to strings before writing to a file? |
| ||
Well the floatstring from the codearchives looks like the solution... any comment? |
| ||
Check out Help -> 2D Category -> File/Stream --> WriteFloat & ReadFloat if you just want to write & read floats to/from files? |
| ||
It is for my physics editor. i need to write a file with B3D code. For example: v# = 0.00001 WriteFile f,"PositionEntity x,0,0," + v# So the file has: PositionEntity x,0,0,0.00001 but i get: PositionEntity x,0,0,1.e-005 which is not directly compilable :( |