%g format again

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

Rob:
Due to a problem with my ISP, I lost a bunch of messages from Euphoria, so I
don't know if you answered my last e-mail on the subject.
The question is:
Why the last item in the following line is printed with only 5 decimals?

printf(1, "%g %g %g %g %g\n", {5, 5.00, 5.100000, 5.1200000, 5.12345678})

5 5 5.1 5.12 5.12346

I think the main utility of the %g format is to show the minimum exact
representation of numbers, so you are not concerned to whether they are
integers or fractional, or how many digits comprise the fraction part.

Because of this problem, PRINT.E by Gabriel Boehme does not give the same
results as standard print().

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

Search



Quick Links

User menu

Not signed in.

Misc Menu