forum-msg-id-134996-edit

Original date:2020-06-24 23:38:39 Edited by: euphoric Subject: Phix:Converting Decimal Value to String Hurts

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 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu