### Re: Phix, numbers, printf, log10

RobertS said...

printf(1, "%e", 12)
1.220000e+1

OK, I've aligned the "fwk" side with the "(f-digit)*10" side and got rid of fadj, and pushed all this to https://raw.githubusercontent.com/petelomax/Phix/master/builtins/VM/pprntfN.e which you may find much easier:

```@ -218,20 +218,26 @@ end for
fwk += epwr
digit += 1
end while
--24/2/24:
f -= fwk
else
digit = floor(f)
--21/2/24:
f = (f-digit)*10
end if
result &= digit+'0'
if precision>0 then
result &= '.'
dotdone = 1
--24/2/24:
--1/11/15
--          for i=1 to precision do
for i=1 to precision-(charflag='g') do
if ewk>0 then
--24/2/24:
--                  f -= fwk
ewk -= 1
epwr = power(10,ewk)
fwk = 0--epwr
@ -240,19 +246,25 @@ end for
fwk += epwr
digit += 1
end while
--24/2/24:
--30/10/21
f -= fwk
else
--21/2/24
--                  f = (f-digit)*10
digit = floor(f)
f = (f-digit)*10
--24/2/24:
end if
--12/7/16:
if digit=10 then exit end if
result &= digit+'0'
end for
--24/2/24:
else
if ewk>0 then
f -= fwk
```

Clearly "p -test" is missing a whole bunch of "%e"-related stuff.