I had - tried - in my mail to point out the only approximate accuracy of pi(), but assumed that pi() should basically represent 𝜋, and not be a deliberately deviating other value.
I think this view has its justification since:
- it intuitively imposes itself to 'simple minded users' ( which I like to use for evaluation of software quality ),
- the gnumeric manual in the functions section explicitly says: ' PI - the constant 𝜋 ' ( https://help.gnome.org/users/gnumeric/stable/gnumeric.html#CATEGORY_Mathematics ),
- pi() in the long version of gnumeric has the value
3.141592653589793238(5...) instead of the double variant
3.141592653589793(1...).
And with all that I thought it considerable to give a result to the users which - by error cancellation - is also school-mathematically meaningful. And would like that better than to argue whether sin(pi()) is 1.2246467991473532E-16 ( double version ) or -5.0165576126683320235E-20 ( gnumeric 'long' ).
With the substitution solution one gets consistent results between school mathematics and FP systems which calculate with different accuracy in a quite good range. This seems to me simply meaningful and the correct way.
Having the same result as MS Excel and LO Calc is considerable reg. compatibility, and a proof for not being totally wrong, it's not! a proof for being correct.
( LO Calc and MS Excel drop the decimal digits behind 15th as they are not guaranteed to be correct in all ranges. )
> If you use sin(mod(2.9, 2.9)) you get 0 too, but that doesn't mean that
sin(2.9) should give 0.
that's not qualified argumenting, the absolute value of sin( x ) is not periodical by 2.9
But - as I anticipated - one can argue about such for a long time ...
:-)
b.s.
---
Gesendet: Sonntag, 29. Mai 2022 um 11:43 Uhr
Von: "Steven D'Aprano" <steve pearwood info>
An: "newbie nullzwei via gnumeric-list" <gnumeric-list gnome org>
Betreff: Re: Re: no tests for trigonometric functions? need help / hints how to adapt tests for gnumeric 'long' version,
On Sun, May 29, 2022 at 11:14:02AM +0200, newbie nullzwei via gnumeric-list wrote:
> the result of sin(x) for x = pi() in gnumeric is 1.2246467991473532E-16,
> and thus somewhat off from the correct value '0'.
That is incorrect.
sin(π) = 0 but pi != π, it is (approximately) 3.141592653589793... and
sin(pi) != 0.
...