Ticket #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: |
Description
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
Change History
Changed 22 months ago by dfindlay
- attachment test-cl-float.lisp added
comment:1 Changed 22 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 22 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.
Updated test script