Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Using (s)printf()

by Anonymous Monk
on Apr 23, 2001 at 23:27 UTC ( #74826=note: print w/replies, xml ) Need Help??

in reply to Using (s)printf()

I keep
bookmarked, since it is by far the most helpful s/printf resource I have found to date.

So: having shmoozed, care to take a question ? -) I have been working with the folks who are rewriting Math::BigFloat, and we have come to a (partial) disagreement. I am of the opinion that zero should be represented, in scientific notation, with exponent == 0; i.e. by something like '0e0'. This belief is at least in part due to the fact that every printf I've encountered renders

printf '%e\n' 0

as something like


Does this representation seem reasonable to you? Is this behavior specified anywhere?

Replies are listed 'Best First'.
(tye)Re: Using (s)printf()
by tye (Sage) on Apr 23, 2001 at 23:36 UTC

    Quoting the article you like so well:

    %g same as %e or %f, whichever printf thinks is best.
    then note that
    printf "%g", 0
    produces simply "0" so 'printf thinks "0" is best'. (:

            - tye (but my friends call me "Tye")

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://74826]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2018-09-18 21:47 GMT
Find Nodes?
    Voting Booth?
    Eventually, "covfefe" will come to mean:

    Results (162 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!