#824 Wrong result from RxCalcSin (for large argument)

v4.0
closed
5
2012-08-14
2009-09-25
Walter
No

rxCalcSin(123456.8900000000,,'R') -> -0.9883646674920869 <<<<<< W R O N G <<<<<<<<
should be 0.9883646674920869
see attachment

Discussion

  • Walter

    Walter - 2009-09-25

    sin is my implementation...

     
    Attachments
  • Walter

    Walter - 2009-09-25

    It may well be that the library routine called by Rexx is wrong

     
  • Rick McGuire

    Rick McGuire - 2009-09-25

    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.

     
  • Walter

    Walter - 2009-09-25

    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 :-(

     
  • Rick McGuire

    Rick McGuire - 2009-09-25

    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.

     
  • Walter

    Walter - 2009-09-25

    I stand corrected:-(
    Thanks
    Walter

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks