Skip to content

A complex number's exact parts become decimals past 10^50, so exp(10^84 i) and cos(10^84 + i) are NaN #2685

Backlog

Description

@Rafael-SOWNet

On master (0b1b7d7), a complex number whose parts are exact stops being exact once a part passes about 10^50. A later operation on it is then treated as an operation on a decimal, and #2674's cut-off for inexact arguments past 10^(precision - 16) makes it NaN. Reference values are from mpmath at 300 digits.

.Evaled master true value
(10^40 + 1/3 + i) - 10^40 1/3 + i same (correct)
(10^50 + 1/3 + i) - 10^50 0.3333333333333333… + i 1/3 + i
(10^60 + 1/3) - 10^60 1/3 same (correct)
(10^60 + i) * (10^60 - i) 1.000…000E+120 (100 digits) 10^120 + 1
cos(10^84) 0.7550644793108826… same (correct)
exp(10^80 * i) -0.9983975062334704… - 0.0565899244281819…i same (correct)
exp(10^84 * i) NaN 0.755064479310883 + 0.655650541129179i
cos(10^84 + i) NaN 1.16512537606148 - 0.770521298548216i
Ci(10^100 + i) NaN -5.74606385289283E-101 - 1.09068296264295E-100i

The real cases keep exact rationals, so cos(10^84) has a value. The complex ones go through EDecimal, which #2684 found in OpSum. Keeping an exact rational part exact through complex arithmetic would let every row above be computed. The NaN for a genuinely inexact argument past the working digits, from #2674, is right and should stay.

Found while fixing #2683 (#2684).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions