chris jefferson writes: > Scott Robert Ladd wrote: > > >Marc Espie wrote: > > > > > >>Heck, I can plot trajectories on a sphere that do not follow great circles, > >>and that extend over 360 degrees in longitude. I don't see why I should be > >>restricted from doing that. > >> > >> > > > >Can you show me a circumstance where sin(x - 2 * pi) and sin(x + 2 * pi) > >are not equal to sin(x)? > > > >Using an earlier example in these threads, do you deny that > >sin(pow(2.0,90.0)) == sin(5.15314063427653548) == > >sin(-1.130044672903051) -- assuming no use of > >-funsafe-math-optimizations, of course? > > > > > > > I would like to say yes, I disagree that this should be true. By your > argument, why isn't sin(pow(2.0,90.0)+1) == sin(6.153104..)? Also, how > the heck do you intend to actually calculate that value? You can't just > keep subtracting multiples of 2*pi from pow(2.0, 90.0) else nothing will > happen,
Actually you can, and this is how real floating-point packages work. Rether than speculate how things _might_ work, I invite you to have a look at glibc sysdeps/ieee754/dbl-64/sincos32.c. Accurate techniques for range reduction are quite well-known, and this list is not an appropriate place for tutorials on floating-point arithmetic. Andrew.