Re: Sine code for ANSI C

From: Dan Pop (Dan.Pop_at_cern.ch)
Date: 05/11/04


Date: 11 May 2004 14:28:56 GMT

In <W1wlc.78210$G_.55362@nwrddc02.gnilink.net> "P.J. Plauger" <pjp@dinkumware.com> writes:

>"osmium" <r124c4u102@comcast.net> wrote in message
>news:c75iuo$i40p9$1@ID-179017.news.uni-berlin.de...
>
>> CBFalconer writes:
>>
>> > "P.J. Plauger" wrote:
>> > >
>> > ... snip ...
>> > > coefficients. But doing proper argument reduction is an open
>> > > ended exercise in frustration. Just reducing the argument modulo
>> > > 2*pi quickly accumulates errors unless you do arithmetic to
>> > > many extra bits of precision.
>> >
>> > And that problem is inherent. Adding precision bits for the
>> > reduction will not help, because the input value doesn't have
>> > them. It is the old problem of differences of similar sized
>> > quantities.
>>
>> Huh? If I want the phase of an oscillator after 50,000 radians are you
>> saying that is not computable? Please elaborate.
>>
>> There was a thread hereabouts many months ago on this very subject and
>AFAIK
>> no one suggested that it was not computable, it just couldn't be done with
>> doubles. And I see no inherent problems.
>
>Right. This difference of opinion highlights two conflicting
>interpretations of floating-point numbers:
>
>1) They're fuzzy. Assume the first discarded bit is
>somewhere between zero and one. With this viewpoint,
>CBFalconer is correct that there's no point in trying
>to compute a sine accurately for large arguments --
>all the good bits get lost.
>
>2) They are what they are. Assume that every floating-point
>representation exactly represents some value, however that
>representation arose. With this viewpoint, osmium is correct
>that there's a corresponding sine that is worth computing
>to full machine precision.
>
>I've gone to both extremes over the past several decades.
>Our latest math library, still in internal development,
>can get exact function values for *all* argument values.
>It uses multi-precision argument reduction that can gust
>up to over 4,000 bits [sic]. "The Standard C Library"
>represents an intermediate viewpoint -- it stays exact
>until about half the fraction bits go away.
>
>I still haven't decided how hard we'll try to preserve
>precision for large arguments in the next library we ship.

Why bother? Floating point numbers *are* fuzzy. Whoever sticks to the
second interpretation has no more clues about floating point than the
guys who expect 0.1 to be accurately represented in binary floating point.

Dan

-- 
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de


Relevant Pages

  • Re: problem with fmod()
    ... computing something like fmod, and that result would ... But what is the use of fmod if it uses unexcact representations internally? ... And thus NOT use 'normal' floating points representation, but something that respects 6.0 as 6.0 and not 5.9999999999999. ...
    (comp.lang.php)
  • Re: How do you keep track of what all the numbers mean?
    ... that if you develop a floating point representation of a system, ... but I would suspect that scaling constants is a main part of it. ... There will be an assumed scaling between the floating point ... will depend upon the input signal power. ...
    (comp.dsp)
  • Re: Rounding of the double
    ... John von Neumann suggested that only fixed-point integers should be used because floating ... If you choose your representation as double, then you have to live with the consequences. ... you can never get precision in any computation on a computer than involves ... MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text - ...
    (microsoft.public.vc.mfc)
  • Re: This calculation is just wrong / computer cant count!
    ... we have is the binary representation of the computer. ... your delusional system of mathematics, one based on a decimal arithmetic model, is ... "ignore" any aspect of floating point precision. ... "I do not wish to deal with the inherent inaccuracy of double precision floating point. ...
    (microsoft.public.vc.mfc)
  • Re: Gentler Decimal Floating-Point
    ... effectively change the radix of a decimal floating point ... under the heading "Logarithms all the time", ... logarithmic representation of numbers to be made workable for all the ... The middle digits are shifted only when the exponent, ...
    (comp.arch.arithmetic)