Shop OBEX P1 Docs P2 Docs Learn Events
Float32Full ATAN inaccurate results — Parallax Forums

Float32Full ATAN inaccurate results

Eviatar TsadokEviatar Tsadok Posts: 6
edited 2007-03-29 08:56 in Propeller 1
Hello,

I am using the floating point library Float32Full + A and I got inaccurate results for the trigonometric function ATAN

A. In bigger number then 50 function bring higher the 90 as a result.
B. In smaller number the function is inaccurate in more then 2 degree.
C. More so the POW function return wrong result for negative number.

Is there any support for this library?

I am stuck in a middle of project thet rely on this library.

Thanks

Eviatar

smhair.gif

Comments

  • cgraceycgracey Posts: 14,133
    edited 2007-03-26 05:45
    Eviatar,

    I will email the author Cam Thomson tomorrow and ask him to fix this. Could you please post some inputs that produce these errors so that he'll be able to get to the problem quickly?

    Sorry for the trouble. We'll get it fixed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • camtcamt Posts: 45
    edited 2007-03-26 16:43
    Eviator,

    I took a quick look at the problems you reported.

    >...A. In bigger number then 50 function bring higher the 90 as a result.
    >...B. In smaller number the function is inaccurate in more then 2 degree.

    I need to do some more testing on the ATAN function to determine the source of this problem.

    >...C. More so the POW function return wrong result for negative number.

    The POW function was only coded for positive numbers. It can easily be changed to handle the negative case. I'll look at adding this code.

    Regards,
    Cam Thompson
    Micromega Corporation

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cam Thompson
    Micromega Corporation
  • Eviatar TsadokEviatar Tsadok Posts: 6
    edited 2007-03-26 19:59
    Chip, Cam,

    Thanks for the quick respond,

    Attach my tests, results in RAD

    first column - the number
    second column - result from mac calculator
    third column - results from Float32FULL

    Number Good Float32

    2.7475 1.222 1.222 - 70 deg ( Good )
    5.6713 1.396 1.404 - 80 deg
    11.430 1.483 1.514 - 85 deg
    22.906 1.527 1.584 - 87.5 deg ( Higher then 90 deg !)
    57.309 1.553 1.635 - 89 deg

    0.140 0.139 0.125 - 8 deg
    0.052 0.052 0.002 - 3 deg
    0.017 0.017 -0.064 - 1 deg ( Negative ! )

    Regards

    Eviatar Tsadok
  • camtcamt Posts: 45
    edited 2007-03-26 21:31
    Hi Eviator,

    The ATAN problem was caused by an incorrect coefficient in the Taylor series. It's been corrected. Code has also been added to POW in both Float32 and Float32Full to handle negative base values. A new zip file in enclosed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cam Thompson
    Micromega Corporation
  • cgraceycgracey Posts: 14,133
    edited 2007-03-27 00:53
    Thanks for fixing this, Cam!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • Eviatar TsadokEviatar Tsadok Posts: 6
    edited 2007-03-29 08:56
    Chip, Cam,

    It works!

    Thanks for the quick and professional respond.

    Eviatar
Sign In or Register to comment.