[GD-Windows] sprintf weirdness
Brought to you by:
vexxed72
From: Andras B. <bn...@ma...> - 2004-07-15 05:15:02
|
Hi, In a normal app, when I write this: sprintf(buf, "%.3f", 0.05f); the contents of buf will be "0.050". But in my app, the result is "0." instead!! The magic barrier seems to be 0.1, as numbers above that (or below -0.1) work OK. Now how's that? Is this a denormal issue?? 0.1 is quite big, isn't it? Still, I suspect that the problem lies in me having my own crt0 (don't ask why :) but I believe I do all the floating point initializations that the original crt0 does (it calls _fpmath(1); or (*_Fpinit)(1); whichever is defined somewhere (which btw only sets the FPU control word AFAICT), but it's still not working the way it should... What is happening here?? I've tried to trace sprintf, but in the end it just uses a function called _cfltcvt, which is totally undocumented and the only thing I could do is reverse engineer the assembly code, which I'd rather not do.. Any ideas what's causing this behavior?? Thanks, Andras |