>> Absolutely weird, there's nothing special inside and it works fine here - double checked it that moment (Win 8.1 64Bit)
Now it works. Don't know what happens.
>> It should demonstrate that the trivial calculation of 's' can be transformed and gives different answers, but all of them show wrong digits.
Of cause. Even with GMP you would end up with such observation. The digit position depends on your set precision.
It is a limitation of arbitrary but still limited precision of real numbers.
Especially for irrational numbers like many root-numbers.
The problem I see is, that you use in the first post a function like ACos() which is only valid between -1 and 1.
Since multiply floating point arithmetics with valid a, b and c (for a triangle) can also lead to numbers like 1.00001
Therefore I use stable functions like:
Code: Select all
Procedure.d ArcSin(Value.d)
If Value < -1.0
ProcedureReturn -#PI/2
ElseIf Value > 1.0
ProcedureReturn #PI/2
Else
ProcedureReturn ASin(Value)
EndIf
EndProcedure
Procedure.d ArcCos(Value.d)
If Value < -1.0
ProcedureReturn #PI/2
ElseIf Value > 1.0
ProcedureReturn 0
Else
ProcedureReturn ACos(Value)
EndIf
EndProcedure
Procedure.d Sqrt(Value.d)
If Value < 0.0
ProcedureReturn 0.0
Else
ProcedureReturn Sqr(Value)
EndIf
EndProcedure
; Because 0.85 != (1.0-0.15) in double precision.
Debug Degree(ASin(0.85/(1.0-0.15)))
Debug Degree(ArcSin(0.85/(1.0-0.15)))
Debug Degree(ACos(0.85/(1.0-0.15)))
Debug Degree(ArcCos(0.85/(1.0-0.15)))
Debug Sqr((1.0-0.15)-0.85)
Debug Sqrt((1.0-0.15)-0.85)
Btw: The GMP Lib has no build-in functions like cos() or sin().