Re: Problems with C floats
- Posted by jimcbrown (admin) Jan 30, 2010
- 2494 views
Yep, I can reproduce the bug.
Looking at line 182 of be_callc.c it is not obvious to me what the cause of the bug is. The casting code looks correct...
I think printf() is a bad example however. See http://www.eskimo.com/scs/cclass/int/sx11c.html and http://en.wikipedia.org/wiki/Stdarg.h#Type_safety
"A float will automatically be promoted to a double."
So when dealing with vararg functions in C, one must always use C_DOUBLE and never C_FLOAT, or things break... likewise, never use C_CHAR or C_SHORT for varargs functions.