From: Alexander B. <ale...@gm...> - 2006-05-25 20:13:24
|
I agree with Robert. In fact on the FPUs such as x87, where floating point registers have extended precision, sin(x % (2%pi)) will give you a less precise answer than sin(x). The improved presision that you see is illusory because gives that 64 bit pi is not a precise mathematical pi, sin(2*pi) is not 0. On 5/25/06, Robert Kern <rob...@gm...> wrote: > Alan G Isaac wrote: > > On Thu, 25 May 2006, Robert Kern apparently wrote: > > >>That your demonstration results in the desired exact 0.0 > >>for multiples of 2*pi is an accident. The results for > >>values other than integer multiples of pi will be as wrong > >>or more wrong. > > > > It seems that a continuity argument should undermine that as > > a general claim. Right? > > Let me clarify. Since you created your values by multiplying the floating= -point > approximation pi by an integer value. When you perform the operation % (2= *pi) on > those values, the result happens to be exact or nearly so but only becaus= e you > used the same approximation of pi. Doing that operation on an arbitrary v= alue > (like 1000000) only introduces more error to the calculation. Floating-po= int > sin(1000000.0) should return a value within eps (~2**-52) of the true, > real-valued function sin(1000000). Calculating (1000000 % (2*pi)) introdu= ces > error in two places: the approximation pi and the operation %. A floating= -point > implementation of sin(.) will return a value within eps of the real sin(.= ) of > the value that is the result of the floating-point operation (1000000 % (= 2*pi)), > which already has some error accumulated. > > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harmless eni= gma > that is made terrible by our own mad attempt to interpret it as though i= t had > an underlying truth." > -- Umberto Eco > > > > ------------------------------------------------------- > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications i= n > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat= =3D121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |