Opened 9 years ago

Closed 9 years ago

#1059 closed defect (fixed)

Intermediate overflow in math functions

Reported by: dfindlay Owned by:
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: Cc:


I wrote some code to exercise CCL's math functions and found that there were cases where intermediate computations were causing floating point overflows.

Functions affected are exp, tan, atan, tanh and atanh:

exp: fails for very large negative real rationals.

tanh: fails for complex arguments with very large real parts.

atanh: fails for numbers of the form 1 + iy for very small y.

tan and atan: analogous failures as for tanh and atanh.

I'm attaching (i) the code to exercise the functions (you just load it into Lisp) and (ii) a file of patches that fix the issues. (Apart from the exp issue, these are present in the fix to 869 - sorry.)

Attachments (2)

test-cl-float.lisp (23.4 KB) - added by dfindlay 9 years ago.
Updated test script
math-patches.lisp (6.4 KB) - added by dfindlay 9 years ago.
Updated math patches

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by dfindlay

Updated test script

Changed 9 years ago by dfindlay

Updated math patches

comment:1 Changed 9 years ago by dfindlay

I've also found that atanh is failing for complex numbers x+iy where x is close to +/- 1 and y is small.

The function phase also seems wrong for minus zeros - it's returning 0 rather than pi.

I've updated the attachments to fix these additional issues.

comment:2 Changed 9 years ago by gb

  • Resolution set to fixed
  • Status changed from new to closed

(In [15705]) More math fixes from dfindlay. Fixes ticket:1059 in the trunk.

Note: See TracTickets for help on using tickets.