Hello ! Continuing my tests of XBLite, I need mathematical functions for numbers of type " LONGDOUBLE ". I' ve found all the functions which I need in " XbLite\Programme\xblite\demo\longdouble \xml " ... except two : the fontion ATANL (inverse of "TANL"), and "EXPL" I am going to try to write it in ASSEMBLER language , but as I know ~ nothing in this language, I would be happy if one of you has a reference, a link or a Web site where I could find these 2 functions for XBLite!!
Thank you in advance for any answer! Cordially, Sospel
ASM fld t[ebp+8] ;get param on stack ASM fld1 ;ST(0)=1.0,ST(1)=param ASM fpatan ;compute atan(ST(1)),divide by ST(0) and pop ST(0) so ST(0)=atan(rad) ASM fstp t[ebp-32] ;write result on ln
ASM fldl2e ; Load log base 2(e) ASM fmulp st1,st0 ; Multiply x * log base 2(e) ASM fst st1 ; Push result ASM frndint ; Round to integer ASM fsub st1,st0 ; Subtract ASM fxch ; Exchange st, st(1) ASM f2xm1 ; Compute 2 to the (x - 1) ASM fld1 ; Load real number 1 ASM fadd ; 2 to the x ASM fscale ; Scale by power of 2 ASM fstp st1 ; Set new stack top and pop
ASM fstp t[ebp-32] ;write result on ln
RETURN ln END FUNCTION
Tested theses funcs quickly but they seem to give correct result.
"longdouble" thanks for your answer : I' ll try these functions to make a test with some functions and their inverse. Afterwards, I will send results ) Cordially, SosPel
I continued the test with the functions to study " LONGDOUBLE " variables . The results are bad! Here is the test: I use a benchmark the formulation of which is this one:
value = 1.0 FOR i=1 TO 10 FOR j=1 TO 1000 FOR k=1 TO 1000 value = Tan(Atan(Exp(Log(Sqrt(value * value)))))+1.0 NEXT k NEXT j NEXT i PRINT "value "; STRING$(value) error=(1.0 - value/1.e7) * 100.0 PRINT "error "; STRING$(error)
( Benchmark take in an old "Sky & Telescope" review)
I adapt these instructions according to the used language (ex: in XBLite, I put all the useful functions in assembler - see precedents posts). All the calculations are made in "DOUBLE PRECISION". Results :
1/in FORTRAN 95 : value = 10000001.000593 , error in % = 0.000010005 [Reference calculation] 2/in GFA-Basic (WinXP) : value = 10000001.001222 , error in % = 0.000010001 [remarkable for a "BASIC"!!] 3/in Visual-Basic 6 : value = 9999818.448501 , error in % = 0.001815515 [acceptable] 4/in Emergence BASIC : value = 9999818.448501 , error in % = 0.001815515 [NB: idem than VB6]. 5/in XBLite D.P : value = 9999818.448501 , error in % = 0.001815515 [NB: idem than VB6].
But on opposite, the XBLite calculation in LONGDOUBLE is false :
6/in XBLite ( LD.P): value = 2.484822
(maybe I made an error of programming?) Temporary conclusion: it would be doubtless interesting that somebody bends over these functions in LD, to bring XBLite at the level of precision of the GFA ???
I took 5 mins to look if LDP functions were giving coherents result compared to DP and i noticed a difference between Log and LogL so i edited function and attached xml2.x.As before i found asm funcs there : http://www.jbox.dk/sanos/source/lib/math/ (BSD license)
[fanboy mode] Prepares to place XBlite 1st [/fanboy mode]
This post contains attachments; to download them you must login.
I continued the test with the functions to study " LONGDOUBLE " variables . The results are bad! Here is the test: I use a benchmark the formulation of which is this one:
value = 1.0 FOR i=1 TO 10 FOR j=1 TO 1000 FOR k=1 TO 1000 value = Tan(Atan(Exp(Log(Sqrt(value * value)))))+1.0 NEXT k NEXT j NEXT i PRINT "value "; STRING$(value) error=(1.0 - value/1.e7) * 100.0 PRINT "error "; STRING$(error)
( Benchmark take in an old "Sky & Telescope" review)
I adapt these instructions according to the used language (ex: in XBLite, I put all the useful functions in assembler - see precedents posts). All the calculations are made in "DOUBLE PRECISION". Results :
1/in FORTRAN 95 : value = 10000001.000593 , error in % = 0.000010005 [Reference calculation] 2/in GFA-Basic (WinXP) : value = 10000001.001222 , error in % = 0.000010001 [remarkable for a "BASIC"!!] 3/in Visual-Basic 6 : value = 9999818.448501 , error in % = 0.001815515 [acceptable] 4/in Emergence BASIC : value = 9999818.448501 , error in % = 0.001815515 [NB: idem than VB6]. 5/in XBLite D.P : value = 9999818.448501 , error in % = 0.001815515 [NB: idem than VB6].
But on opposite, the XBLite calculation in LONGDOUBLE is false :
6/in XBLite ( LD.P): value = 2.484822
(maybe I made an error of programming?) Temporary conclusion: it would be doubtless interesting that somebody bends over these functions in LD, to bring XBLite at the level of precision of the GFA ???
Cordially SosPel
Hi,
I believe the trouble is just with the naming convention used in the xml library. The LogL function should really be named Log10L, and the LnL should be LogL. So for your test above, use LnL instead of LogL.
When using the correct functions, I got the folowing results from the benchmark:
value 1.000000100111374133d+7 error -1.001113741329546017d-5
I will correct the functions names in xml so they correspond correctly with the xma functions.
Thanks to D. Administrator : I' ve changed LnL in formula and now, I have same excellent results. Well, Xblite is as well good as GFA !! Now, I go to another programs ...