in reply to Re: for loop with float
in thread for loop with float

Why do it yourself when printf can do it for you?

print 6 - 1e-14;; 5.99999999999999 printf "%.f\n", 6 - 1e-14;; 6 printf "%.1f\n", 6 - 1e-14;; 6.0 printf "%.2f\n", 6 - 1e-14;; 6.00

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^3: for loop with float
by jethro (Monsignor) on Jul 25, 2008 at 03:31 UTC
    Because I would do anything to avoid printf. I've written a rounding sub in half the time I need to read the printf man page. For me printf is symbolizing the awkwardness of C programming I'm happy to have left behind

    But thanks for the TMTOWTDI ;-)