Dear Regina,

It is completely irrelevant how accurate the implementation is.


The problem is that:
sin(10000000000000000) = a very accurate number
sin(10000000000000000 + pi) = (-1) * (the very accurate number from above)

The difference between those 2 numbers is only pi!
BUT:
pi might be too small with those BIG numbers!
If Calc aproximates 10000000000000000 + pi as 10000000000000000,
because it cannot store (10000000000000000 + pi) to the relevant
digit, then you get bullshit and sinus cannot be computed accurately.

Lets give another example:
sin(10^16 * pi) = 0
sin(10^16 * pi + pi/2) = -1

However, if the accuracy of storing 10^16 * pi + pi/2 is less than pi/2,
then the actual computed result will be anything between -1 and +1,
without any resemblance to the truth. And it does NOT depend
on the accuracy of the math library. It depends on how Calc stores
the number: 10^16 * pi + pi/2.

How many decimals are sotred?
If it is inaccurate even to the first decimal or, even worse,
the first digit (pi/2 ~ 1.57), then it does NOT make sense
to compute the sinus of it.

I hope this explains why there must be an upper limit (unlike
monotone functions, where the value is continuously changing
in a single direction, sinus is not a monotone function).

Sincerely,

Leonard Mada



-------- Original-Nachricht --------
> Datum: Sun, 09 May 2010 18:07:22 +0200
> Von: Regina Henschel <[email protected]>
> An: [email protected]
> Betreff: Re: [sc-dev] constraint of x in sin(x) in scaddins

> Hi Leonard,
> 
> it seems, that I have not been clear enough. sin() is a function in the 
> math library of C and C++ compilers and is nowadays accurate in double 
> precision up to x<2^64. To prevent larger arguments the special 
> implementation ::rtl::math::sin() is used in OOo. But inside the 
> implementation of IMSIN() in the module scaddins a constraint 
> "x<134217728" is used. I only want to know, why this has been 
> introduced. I doubt, that this restriction is still necessary.
> 
> I know, that a lot of binary values give different results for sin(), 
> although they are shown with the same decimal values in 15 digit 
> precision (the highest precision Calc UI has). But that is not central 
> point of my question.
> 
> kind regards
> Regina
> 
> 
> Leonard Mada schrieb:
> > Dear Regina,
> >
> > I believe that sin() should have as constraint the largest float
> > (or integer) that fulfills the following condition:
> > sin(max) = correct result + epsilon
> > sin(max + lambda) = correct result + epsilon ,
> > where lambda is a float in the interval (0, pi/2).
> >
> > Let me explain this a little bit.
> >
> > sin: [any float] ->  [-1, 1]
> >
> > sin(pi/2) = 1
> > sin(pi/2 + pi/2) = 0
> >
> > So basically, if we want to compute sin() at some precision,
> > we have to guarantee that the number we compute the sinus of,
> > can be accurately represented. Else, we risk a total fiasco, because
> > sin(a_very_big_number) may correspond to any value in [-1, +1],
> > as the last digits in a_very_big_number are not accurate.
> >
> > So, big_number +/- pi/2 may be represented as big_number,
> > although the sinus would have different signs for those
> > "theoretically" different numbers.
> >
> > Therefore, the number which still makes sense to compute the sinus off,
> > should fulfill the requirements set above.
> >
> > We still need to determine what values lambda and epsilon take,
> > but I hope that the general idea is clear.
> >
> > Basically, this also depends on the implementation of general numbers
> > in the particular software (Calc in this example).
> >
> > Some may store 16 decimal digits, so 1.xxx * 10^16 is still ok
> > to compute the sin() (or marginally so), some may store 32 digits,
> > so 1.xxx * 10^32 would be fine in that case.
> >
> > I believe that lambda should be not bigger than pi/4,
> > while epsilon is flexible in this case (e.g. 10^-6 is probably
> > sufficient).
> >
> > Sincerely,
> >
> > Leonard Mada
> >
> >
> >
> > -------- Original-Nachricht --------
> >> Datum: Sat, 08 May 2010 21:02:45 +0200
> >> Von: Regina Henschel<[email protected]>
> >> An: Calc dev<[email protected]>
> >> Betreff: [sc-dev] constraint of x in sin(x) in scaddins
> >
> >> Hi all,
> >>
> >> I have notice a constraint "SinOverflow" (which is x>=134217728) in
> >> analysishelper.cxx in scaddins. What is the special reason for it?
> >>
> >> In other places with sin() the version ::rt::math::sin() is used to get
> >> a guard for overflow. That would result in constraint
> >> x<=9,22337203685478E+018, which is much larger.
> >>
> >> If there is no special reason, should I replace it, while I work on the
> >> missing complex trigonometric functions?
> >>
> >> kind regards
> >> Regina
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to