Re: [R] Rounding?

From: jim holtman <jholtman_at_gmail.com>
Date: Mon, 11 Jun 2007 08:04:10 -0400

A good reference is:

*What Every Computer Scientist Should Know About Floating-Point* *...*<http://docs.sun.com/source/806-3568/ncg_goldberg.html>

http://docs.sun.com/source/806-3568/ncg_goldberg.html

On 6/11/07, BXC (Bendix Carstensen) <bxc_at_steno.dk> wrote:
>
> I was a bit puzzed by:
>
> > formatC(6.65,format="f",digits=1)
> [1] "6.6"
>
> So I experimented and found:
>
> > formatC(6.6500000000000001,format="f",digits=1)
> [1] "6.6"
> > formatC(6.650000000000001,format="f",digits=1)
> [1] "6.7"
> > round(6.6500000000000001,1)
> [1] 6.7
> > round(6.650000000000001,1)
> [1] 6.7
> > version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 5.0
> year 2007
> month 04
> day 23
> svn rev 41293
> language R
> version.string R version 2.5.0 (2007-04-23)
>
> My machine runs Windows NT.
>
> Is this intended or just a Windows facility?
> ______________________________________________
>
> Bendix Carstensen
> Senior Statistician
>
> Steno Diabetes Center
> Niels Steensens Vej 2-4
> DK-2820 Gentofte
> Denmark
> +45 44 43 87 38 (direct)
> +45 30 75 87 38 (mobile)
> +45 44 43 73 13 (fax)
> bxc@steno.dk http://www.biostat.ku.dk/~bxc
>
> This e-mail (including any attachments) is intended for the ...{{dropped}}
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 11 Jun 2007 - 12:09:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Jun 2007 - 12:31:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.