*From*: newbie nullzwei <newbie-02 gmx de>*To*: jsd av8n com, Gnumeric Forum <gnumeric-list gnome org>*Subject*: Aw: Re: no tests for trigonometric functions? need help / hints how to adapt tests for gnumeric 'long' version,*Date*: Sun, 29 May 2022 11:14:02 +0200

hello @John Denker, :-)

thank you for your qualified answers, will review them in detail later.

At the moment I'm less working on trig problems - but see below - but more on gnumeric and what it's doing.

Thus why the trig.xls sheet is not evaluated by a test?, why it contains a reference not met by my system? ...

Besides that I have an idea of how trig. calculations / results can possibly be improved, by:

- a different understanding of the approximation of pi(), and

- other ways to calculate, accounting the periodicity and substitutability of trig functions ...

but that's more a mathematical than a gnumeric question.

As you are intereted in / working on such, a simple example of the approach what I think what can be improved - WIP, provisoric! :

the result of sin(x) for x = pi() in gnumeric is 1.2246467991473532E-16, and thus somewhat off from the correct value '0'.

If you use sin(mod(x,pi())) for the absolute value, you get the correct zero, and you can use '=if(isodd(x/pi()),-1,1)' to generate a suitable sign,

thus '=if(isodd(x/pi()),-1,1)*sin(mod(x,pi()))' gives approximately the same results as sin(x), but is 'more correct' at and near the zeros.

Yes, one can argue about 'more correct' since zero is of course also wrong based on the approximated value for pi() ...

I think from a 'simple minded user'-POV it is quite acceptable if the error in the calculation of pi() for the argument of his formula cancels out with the error in the evaluation with mod-pi() and he gets a result what he expects ... one can certainly argue endlessly ...

I throw this into the ring as a suggestion: wherever in the accuracy of the argument of a function influences of the inaccuracy of pi() may be assumed, the above or similar formulas may be used for reasonable results ... IMHO.

my general POV: we need results that match the mathematical correct result for the formula / arguments originally given / intended, not for the devaiting approximations irrationality, FP-conversion or other influences made of it.

If you use sin(mod(x,pi())) for the absolute value, you get the correct zero, and you can use '=if(isodd(x/pi()),-1,1)' to generate a suitable sign,

thus '=if(isodd(x/pi()),-1,1)*sin(mod(x,pi()))' gives approximately the same results as sin(x), but is 'more correct' at and near the zeros.

Yes, one can argue about 'more correct' since zero is of course also wrong based on the approximated value for pi() ...

I think from a 'simple minded user'-POV it is quite acceptable if the error in the calculation of pi() for the argument of his formula cancels out with the error in the evaluation with mod-pi() and he gets a result what he expects ... one can certainly argue endlessly ...

I throw this into the ring as a suggestion: wherever in the accuracy of the argument of a function influences of the inaccuracy of pi() may be assumed, the above or similar formulas may be used for reasonable results ... IMHO.

my general POV: we need results that match the mathematical correct result for the formula / arguments originally given / intended, not for the devaiting approximations irrationality, FP-conversion or other influences made of it.

:-)

Bernhard

---

**Gesendet:** Sonntag, 29. Mai 2022 um 05:27 Uhr

**Von:** "John Denker via gnumeric-list" <gnumeric-list gnome org>

**An:** "Gnumeric Forum" <gnumeric-list gnome org>

**Betreff:** Re: no tests for trigonometric functions? need help / hints how to adapt tests for gnumeric 'long' version,

Bernhard

---

On 5/27/22 9:26 PM, newbie nullzwei via gnumeric-list wrote:

> In my double version tan(pi()/2) fails with 16331239353195370 instead of the

> reference 16324552277619072, tan(3/2*pi()) and the negative values fail too,

> exotic processor? messed up system? updated libraries??? how reliable are the

> references?

1) See my previous message from 5/28/22 12:43 AM.

2) Here is more detail about how I think about it.

...

> In my double version tan(pi()/2) fails with 16331239353195370 instead of the

> reference 16324552277619072, tan(3/2*pi()) and the negative values fail too,

> exotic processor? messed up system? updated libraries??? how reliable are the

> references?

1) See my previous message from 5/28/22 12:43 AM.

2) Here is more detail about how I think about it.

...

**Follow-Ups**:

**References**:

[Date Prev][Date Next] [Thread Prev][Thread Next] [Thread Index] [Date Index] [Author Index]