Re: Phix, numbers, printf, log10
- Posted by RobertS in February
- 1026 views
petelomax said...
Update: I've now got a fix for the first part ("%e" was not updating f the same way "%f" does as it printed digits):
Sorry, maybe it's my fault and I did it wrong, but now I get:
printf(1, "%e", 12)
1.220000e+1
It works for numbers < 10, gets the last digit right, but when there is more than 1 digit before the decimal point, the digit before the decimal point gets repeated:
printf(1, "%e", 123.456)
1.2334563e+2
But I may have misunderstood how to edit the file. I now have
else digit = floor(f) --21/2/24: f = (f-digit)*10 end if result &= digit+'0' expadj = 1 if precision>0 then
and
--30/10/21 fadj = fwk else --21/2/24 digit = floor(f) f = (f-digit)*10 fadj = 0 end if --12/7/16: if digit=10 then exit end if
Anyway, when this is fixed, it will help a lot, thank you!
Robert