Hi Regina,

On Saturday, 2010-05-08 21:02:45 +0200, Regina Henschel wrote:

> I have notice a constraint "SinOverflow" (which is x>=134217728) in  
> analysishelper.cxx in scaddins. What is the special reason for it?

Having tried I confirm that Excel has that constraint, or more specific
x<134217728. I don't know adhoc why it is 2^27 though.

> 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.

See comment in sal/inc/rtl/math.hxx for isValidArcArg(). We rely on the
trigonometric functions being implemented such that radians up to 2^64
(=1.844e19) are supported. Re-thinking that, also per the comments
Leonarda gave, we should lower the limit to a value representable in
a double's (binary64) mantissa of 53 bits. For consistency with the
approx functions I suggest a constraint x<=2^48

About the IEEE 754 specification mentioned there: Unfortunately I can't
find that 2^64 requirement, apparently the standard itself does not say
so, just checked. Maybe it did in an older public draft, as
a recommendation. Apparently C math libraries implement it such.

> If there is no special reason, should I replace it, while I work on the  
> missing complex trigonometric functions?

Note that this SinOverflow() of the Analysis Add-In is used with IMSIN()
and IMCOS() only. However, in Excel also the SIN(), COS() and TAN()
functions are affected by the x<134217728 constraint, which we handle
using the ::rtl::math approach.

I think we can safely replace SinOverflow() with
::rtl::math::isValidArcArg() if we chose a better limit for that.

  Eike

-- 
 OOo/SO Calc core developer. Number formatter stricken i18n transpositionizer.
 SunSign   0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
 Please don't send personal mail to the [email protected] account, which I use for
 mailing lists only and don't read from outside Sun. Use [email protected] Thanks.

Attachment: pgp7AvObGztvv.pgp
Description: PGP signature

Reply via email to