Skip to content

QUESTION ON ROUNDING

3 messages · Andras Farkas, R. Michael Weylandt, Duncan Murdoch

#
On Thu, Mar 28, 2013 at 6:21 PM, Andras Farkas <motyocska at yahoo.com> wrote:
I'd guess you've played with the default digits for print() (perhaps
via options) but a reproducible example would be terribly lovely.

MW
#
On 28/03/2013 2:21 PM, Andras Farkas wrote:
You are confusing rounding and string conversion.  I imagine

0.07099999999999999

is what you get when you print 0.071 with 17 digits, because 0.071 can't 
be represented exactly in the double precision floating point that R 
uses.  If you want to format it for display, then use format() (or 
sprintf(), or one of the other formatting functions), don't use round().

Duncan Murdoch