Re: [Rd] Floating point precision / guard digits? (PR#13771)

From: Stavros Macrakis <macrakis_at_alum.mit.edu>
Date: Sat, 20 Jun 2009 08:44:21 -0400

  1. this is not a bug, so this is the wrong list
  2. 'underflow' does not mean what you think it means.
  3. guard digits and sticky bits do improve rounding behavior, but floating point will always remain approximate.
  4. if it is important to your application to perform exact arithmetic on rational numbers (and I suspect it is not), you might want to use that instead of floating-point. But even if implemented in R, most R calculations cannot use it.

You may want to study up on floating-point arithmetic some more, though.

         -s

On 6/19/09, rbugs09_at_kreil.org <rbugs09_at_kreil.org> wrote:
> Full_Name: D Kreil
> Version: 2.8.1 and 2.9.0
> OS: Debian Linux
> Submission from: (NULL) (141.244.140.179)
>
>
> Group: Accuracy
>
> I understand that most floating point numbers are approximated due to their
> binary storage. On the other hand, I thought that modern math CPUs used
> guard
> digits to protect against trivial underflows. Not true?
>
> # integers, no problem
>> 1+1+1==3
> [1] TRUE
> # binary floating point approximation underflows
>> .1+.1+.1==.3
> [1] FALSE
>> .1+.1+.1==.3
> [1] FALSE
> # binary floating point exact for certain numbers
>> .1+.1==.2
> [1] TRUE
>
> I know that safe code should not test for quality of floats. Still, is R
> underutilizing the power of the underlying hardware?
>
> Grateful for comments,
> David.
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat 20 Jun 2009 - 12:47:20 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 Sat 20 Jun 2009 - 23:30:58 GMT.

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

list of date sections of archive