#41899 - rize - Mon May 02, 2005 10:09 pm
I thought that there should be a function to help print f32's in a visible manner somewhere (since the consolePrintf won't take floats), but I didn't see one in the library.
If anyone needs to print an f32 you can print it in two parts like so:
It's not perfect and it could be faster, but it's not bad for debug.
If anyone needs to print an f32 you can print it in two parts like so:
Code: |
int s = sqrtf32(intof32(2)); consolePrintf("sqrtf32(2) = %d.%d", f32toint(s), f32fraction(s)); //f32toint is already in the library. inline int f32fraction(f32 a) { return (int)((a & 0x00000FFF)/0.4096); } |
It's not perfect and it could be faster, but it's not bad for debug.