during implementation of haversine() algorithm I found out, that the parameters of the ATan2()
function are switched.
http://www.purebasic.fr/english/viewtop ... 26#p363826
A few comparrisons with 'C' code and an own implementation demonstrated this behaviour.
ATan2(0.0705, 0.9975) should return something arround 0.070559
But the current implementation results in 1.500237
My own creation
Code: Select all
Procedure.f atan2_bkk(y.f, x.f)
Result.f = 0
If x > 0
Result = ATan(y/x)
ElseIf x < 0
Result = ATan(y/x) + #PI
Else
If y > 0
Result = #PI / 2
ElseIf y < 0
Result = #PI / -2
Else
Result = 0
EndIf
EndIf
ProcedureReturn Result
EndProcedure
Than I tested ATan2() with switched parameters and it gaves the right result:
ATan2(0.9975, 0.0705) -> 0.070559
I tested it only in Windows, but I think this bug is also in the other versions.
Please can someone confirm this bug?
Bernd