Re: WMS FORTRAN: what are SIND, COSD, etc?



James Giles wrote:
Rich Townsend wrote:
...

I disagree; I would be very happy if SIN(ACOS(-1.)) returns zero. Why
would that be an error?


I wouldn't be very happy with that at all.  Suppose I explicitly
input a representable number that's very close to the transcendental
number pi. That number isn't pi, but it's close.  The sine of that
number is not zero.  In fact, it's further from zero than the smallest
representable floating-point value (by a very large margin).  When
I apply SIN to that number I expect an accurate calculation of
the sine of the input value - I do *NOT* want the implementation
to guess that I must really have meant pi!  It's perfectly plausible
that I didn't mean pi at all, but some value that was, in a way that's
important to my problem, explicitly different from pi.

Some might want a value that is near 3.14 and has a sin() of zero. Especially those multiplying a value by pi/180 before sending it to sin().

Now, since the SIN function have no way of detecting where its
argument came from, any result of a claculation that generates that
same "nearly pi" value must return the same value for SIN as rthe
explicitly input argument did.  To do otherwise complicates
numneric stability calculations intolerably.  Do you really want
to have to guess about what guesses the implementation made
about your computation?  Or would you rather have all operations
be well-defined and operate consistently?

On the other hand, I would expect a proper implementation of
SIND(ACOSD(-1.0)) to compare exactly equal to zero.

That would be nice.

-- glen

.



Relevant Pages

  • Re: opponents of taylor and lhospital ?
    ... limit as x goes to zero of (sin x) over x. ... The objection is that to use l'Hopital, ... How does one develop the taylor series for sine without knowing how ...
    (sci.math)
  • Re: sin x / x tends to 1...
    ... Darren J Wilkinson wrote: ... > I've a question about the limit of sin x / x as x tends to zero. ... Regards ...
    (sci.math)
  • Re: SIND, COSD, TAND functions
    ... sine is zero, then I recommend you lobby for an accurate degree- ... quite a few representable non-zero values of X is zero. ... if the arguments to the radian-based trig functions were restricted ...
    (comp.lang.fortran)
  • Re: Should the normal SINE and Zero padded SINE curves be the same for fft output?
    ... Now the assumed period has a single sine cycle and a zero-valued segment of equal length for a total "period" of 2sec. ... The "gate wave" has a Fourier Transform that is a periodic sinc or Dirichlet. ... Because of it's particular character it's alternately zero and non-zero valued and the non-zero values alternate in sign except at the peaks which are nonzero for 3 samples. ...
    (comp.dsp)
  • Re: WMS FORTRAN: what are SIND, COSD, etc?
    ... > moment (courtesy CVF) ... > sin() to match its mathematical expectations. ... sine is zero - or even sufficiently close to zero to print as zero. ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)