[R] calculating error

james.holtman@convergys.com james.holtman at convergys.com
Mon Sep 13 00:39:48 CEST 2004





This is in the FAQs.  It has to do with representation of floating point
numbers.  You can not represent 'pi' exactlly in the 53 bits of precision
in floating point.  If you notice, 2^-53 is 1.1e-16 which indicates the
'roundoff' is in the least significant bit of the precision; this is to be
expected with floating point numbers.
__________________________________________________________
James Holtman        "What is the problem you are trying to solve?"
Executive Technical Consultant  --  Office of Technology, Convergys
james.holtman at convergys.com
+1 (513) 723-2929


                                                                                                                                           
                      "Branimir K.                                                                                                         
                      Hackenberger"                To:       <r-help at stat.math.ethz.ch>                                                    
                      <hack at ffos.hr>               cc:                                                                                     
                      Sent by:                     Subject:  [R] calculating error                                                         
                      r-help-bounces at stat.m                                                                                                
                      ath.ethz.ch                                                                                                          
                                                                                                                                           
                                                                                                                                           
                      09/12/2004 14:28                                                                                                     
                                                                                                                                           
                                                                                                                                           





Could anybody explain this results?

>sin(2*pi)
-2.449213e-16         #should be zero


>(10^16)*sin(log2(4)*pi)
-2.449213             #should be zero too


and explain what to do to correct this events?

Thanks!!!


Branimir K. Hackenberger

______________________________________________
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




More information about the R-help mailing list