string to real conversion losing data

BCS none at anon.com
Thu Apr 8 16:58:04 PDT 2010


Hello bearophile,

> writefln("%.5f\n", tot); // 17744.06000

Never trust your output function :) (e.i. always check to see if it's doing 
what you think it is.)

Back in the bad old days, a guy I knew spent a while debugging a problem 
that turned out to be that he was loading data as float but storing it into 
an int (think an invalid scanf format string). Every time he checked things 
though things seems OK because he had the same bug in his output as well 
(think printf).

-- 
... <IXOYE><





More information about the Digitalmars-d-learn mailing list