Phix:Converting Decimal Value to String Hurts

new topic     » topic index » view thread      » older message » newer message

How do I get more accuracy in conversion?

object num = 23.7 
printf(1,"%f\n",{num}) 
printf(1,"%0.15f\n",{num}) 
 
num = 23.1234567890123456789 
printf(1,"%f\n",{num}) 
printf(1,"%0.15f\n",{num}) 

Results:

23.700000 
23.699999999999999 -- expect 23.700000000000000 
23.123457 
23.123456789012344 -- expect 23.123456789012345 

Ha! I found this thread where I'm asking the same thing. Oops! grin

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu