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

2022-06-17 Thread newbie nullzwei via gnumeric-list
  
>> - how to deal with / construct tests for functions / ranges where 'long' and 
>> 'double' version have justified different results?  
    ( how to build tests which allow / demand improved results, but accept 
'double accuracy results' when using double datatype? )  
  
let me give it an example ( pros will find better ones ):  
  
t1013-crlibm, crlibm.gnumeric, row 18278:  
  
formula:     '=exp(239.043590469953)'  
reference:   6.536003490281019E+103,  
'double' result: 6.536003490281019E+103    - 'quality': ' ' or '99' 
or 100% or best ...  
'long' result:   6.536003490281029007E+103 - 'quality' only 
14.819377377076821122 digits, thus bad?  
my 'srt-deco-round' version: 6.536003490281095E+103,   - 'quality' only 
13.934498683160548 digits, thus worse? but!!!  
correct acc. 'ttmath.org':   
6.5360034902810943723150710853138994266057660109196409934141980800730... E103,  
and acc. 'wolframalpha.com': 
6.5360034902810943723150710853138994266057660109196409934141... × 10^103  
  
thus ttmath and wolframalpha seem correct ( equal ), 6.536003490281094E+103 
would be the best approximation with doubles,  
my improved version second, 'long' third and double 'acceptable' ?  
  
idea ... use the correct result as reference, protect against messing it up by 
saves from low capa versions by storing as text ( '=value(" ")' ), prepare 
for future improved versions by storing more digits (50?), calculate the 
'quality' ( correct digits? ) with the log formula as of now, and require a 
threshold of e.g 13.9 digits for double and 16.9 digits for long results to 
pass the test ... ???  one would immediately see that the long version has far 
less accuracy ( ~13.99 digits ) than it pretends by it's precision, and could 
try to dig for the reason ...  
  
disclaimer: 'no!', I don't really need this level of accuracy, I'm seeking for 
modes to calculate which don't undermine math logic, and in this area - tests - 
I am looking for something that is oriented to normal mathematics, rewards good 
results and marks deviations ... for this I also have to play through extreme 
considerations ...
___
gnumeric-list mailing list
gnumeric-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gnumeric-list


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

2022-05-31 Thread newbie nullzwei via gnumeric-list


 
but not yet clear to me: 
 
- should 'trig.xls' be subject to a test, or do we have enough testing for trigonometric functions in other tests, e.g. that for complex numbers? 
 
- how to deal with - construct tests for functions / ranges where 'long' and 'double' version have justified different results? 
    ( how to build tests which allow / demand improved results, but accept 'double accuracy results' when using double datatype? ) 

( O.T. but to show that answers are read:
@John Denker, think you wanted to write 70742377520284**40**.275766 / 2^52 for the zero-point of cot(),
yes, I'm aware that π is irrational and even most rational values can only be approximated by bin-FP figures. My idea wasn't to blame the FPU for not being member of the mission impossible team, but to apply another understanding of the argument. If it's just a numerical value ... calculate the trig functions as good as we can, evtl. we can do a little better using long precision ( mean to have seen a 60 significant decimal digit value assigned to a **double** variable 'y' in code ), and evtl. we can do a little better accounting the periodicity of or mathematical substitutions between the trig functions ... not yet evaluated. 
But if the argument obviously contains symbols for values which can't be represented, or functions like pi() which pretend to calculate a irrational or irrepresentable value 'as good as possible', then it's justified to achieve an 'as good as possible' result by taking the approximation error off the table ... if we can. wouldn't mind to open an issue 'can trig function calculations be improved?', but I'm not far enough in evaluating, and at the moment I'm busy with other issues. ) 
 
:-)


___
gnumeric-list mailing list
gnumeric-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gnumeric-list


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

2022-05-30 Thread newbie nullzwei via gnumeric-list


as often with gnumeric, you ( I ) think to have a good idea ... it's already in ... 
 
there is a function 'sinpi' which calculates sin for multiples of 휋 to better accuracy. same for cos and tan, not for asin, acos, atan. 
 
IMHO it's still considerable to change the results of sin(x*pi()), accounting pi() as a deputy / placeholder for 휋. 

___
gnumeric-list mailing list
gnumeric-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gnumeric-list


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

2022-05-29 Thread newbie nullzwei via gnumeric-list

hello @Steve D'Aprano,

 

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" 
An: "newbie nullzwei via gnumeric-list" 
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.

...



___
gnumeric-list mailing list
gnumeric-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gnumeric-list