Ticket #1059 (closed defect: fixed)

Opened 18 months ago

Last modified 18 months ago

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.)


test-cl-float.lisp Download (23.4 KB) - added by dfindlay 18 months ago.
Updated test script
math-patches.lisp Download (6.4 KB) - added by dfindlay 18 months ago.
Updated math patches

Change History

Changed 18 months ago by dfindlay

Updated test script

Changed 18 months ago by dfindlay

Updated math patches

comment:1 Changed 18 months 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 18 months ago by gb

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

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

Note: See TracTickets for help on using tickets.