sin is my implementation...
rxCalcSin(123456.8900000000,,'R') -> -0.9883646674920869 <<<<<< W R O N G <<<<<<<<
should be 0.9883646674920869
see attachment
It may well be that the library routine called by Rexx is wrong
The rxmath routines are just an interface to the compiler provided math libraries, so the results are totally dependent upon how those libraries are implemented. When dealing with the limits of double value precision and how the library functions implement rounding, the last digit can vary. This is largely platform dependent. For example, running this on Linus and Windows produces a different last digit. Also running on 64-bit system will produce a result that can differ from running on a 32-version of the same OS.
It's not the last digit .. I understand that
It's the sign!!!!
I smell 4 possibilities:
a) conversion to double passes a wrong argumet to the library
b) the underlying library routine is wrong
c) the conversion of the library's result is wrong
d) I am wrong (very unlikely :-)
Closing this bug I consider premature :-(
Your calculation is the incorrect one. Your normalization procedure is incorrectly subtracting pi until it gets a value less than pi. However, there are 2pi radian in a circle, so the iteration limit should be while y>2*pi. Using your normalization, the angle value for the comparison is 1.72559780000, but the correct normalization value is 4.867104000, for which rxmath gives the same signed result as the full value.
I stand corrected:-(
Thanks
Walter
Anonymous