Phix:Converting Decimal Value to String Hurts
- Posted by euphoric (admin) Jun 24, 2020
- 951 views
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!