From: Sasha <nd...@ma...> - 2006-05-25 21:28:43
|
This example looks like an artifact of decimal to binary conversion. Consider this: >>> epsilon =3D 1./2**16 >>> epsilon 1.52587890625e-05 >>> sin(100*pi+epsilon) 1.5258789063872671e-05 >>> sin((100*pi+epsilon)%(2*pi)) 1.5258789076118735e-05 and in bc: scale=3D50 epsilon =3D 1./2.^16 s(100*pi + epsilon) .00001525878906190788105354014301687863346141310239 On 5/25/06, Alan G Isaac <ai...@am...> wrote: > On Thu, 25 May 2006, Robert Kern apparently wrote: > > What continuity? This is floating-point arithmetic. > > Sure, but a continuity argument suggests (in the absence of > specific floating point reasons to doubt it) that a better > approximation at one point will mean better approximations > nearby. E.g., > > >>> epsilon =3D 0.00001 > >>> sin(100*pi+epsilon) > 9.999999976550551e-006 > >>> sin((100*pi+epsilon)%(2*pi)) > 9.9999999887966145e-006 > > Compare to the bc result of > 9.9999999998333333e-006 > > > bc 1.05 > Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, In= c. > This is free software with ABSOLUTELY NO WARRANTY. > For details type `warranty'. > scale =3D 50 > epsilon =3D 0.00001 > s(100*pi + epsilon) > .00000999999999983333333333416666666666468253968254 > > Cheers, > Alan > > > > > ------------------------------------------------------- > 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?cmdlnk&kid=107521&bid$8729&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |