Re: Exponent Format specifiers for %g

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Ben Voigt" <rbv@xxxxxxxxxxxxx> wrote in message
news:O1RwPNfdHHA.4720@xxxxxxxxxxxxxxxxxxxxxxx

"Charles Wang[MSFT]" <changliw@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:m8k9kqcdHHA.4568@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi, Buddy,
Appreicate your understanding that this is by design. There is no way to
control the format of the exponent in VC++. In VC++, there is just 3
digits
of the exponent. You can say it is the least and also the most. So it can
provide a consitent output format with 3 digits of the exponent.

It is not consistent with the ANSI standard for printf.

It *is* consistent with C89, the original C Standard. It
is not consistent with C99, the current C Standard, but that
is just one of many ways in which the Microsoft C library
fails to conform to C99, so what the heck.

If there's sufficient demand by customers, Microsoft might
feel moved to upgrade to C99, but so far it has apparently
not been a high priority item.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com


.



Relevant Pages

  • Re: c99 says what about the number of digits in a zero exponent?
    ... Is the two digits in the exponent mandated or just something gcc does? ... so now lcc-win writes three zeroes as Microsoft. ... C99 is more specific: "The exponent always contains at least two ...
    (comp.lang.c)
  • Re: Very small numbers & formatting
    ... full exponent can be shown. ... The case in standard is slightly more restrictive than this. ... If you explicitly specify the exponent width, ... more than 3 digits of exponent. ...
    (comp.lang.fortran)
  • fprintf: number of digits for exponent
    ... I tried to print numbers in scientific notation with fprintf. ... standard size for the exponent is 3 digits, ... Is there a possibility to reduce the number of digits for the ...
    (comp.soft-sys.matlab)
  • Re: fprintf: number of digits for exponent
    ... Thomas wrote: ... > standard size for the exponent is 3 digits, ... > Is there a possibility to reduce the number of digits for the ...
    (comp.soft-sys.matlab)
  • Re: Exponent Format specifiers for %g
    ... %g behaves like %e. ... The standard ... has this to say about %e: "The exponent always contains at least two ... digits, and only as many more digits as necessary to represent the ...
    (microsoft.public.vc.language)