Dave Korn wrote: > Have you considered that your sunblade might be operating > in a different rounding mode, by default?
I didn't know there were different rounding modes. I thought everyone used so-called "unbiased rounding", so I'm sorry for adding confusion. > I would imagine that printf may well work under-the-hood > by shifting the desired decimal places above the point, > rounding to integer, and printing out that number. Could be. I haven't dug into those matters, but your suggestion certainly makes sense. Anyway, the following line seq -4.5 1 4.5 | while read x; do printf '%4s -> %3.0f\n' $x $x; done which gives -4.5 -> -4 -3.5 -> -3 -2.5 -> -2 -1.5 -> -1 -0.5 -> -1 0.5 -> 1 1.5 -> 1 2.5 -> 2 3.5 -> 3 4.5 -> 4 suggests that printf rounds towards zero, but something funny happens for -0.5 and 0.5. Peter
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/