Skip to content

A part that is exactly 0 is returned as a large number once the other part is large: cos(pi/2 + 1000 i) has a real part of -8.8E+332 #2700

Description

@Rafael-SOWNet

On master (82eb869), a part that is exactly 0 for an exact argument is returned as a large number once the other part is large. Example: cos(pi/2 + y i) is -i sinh(y), with real part exactly 0.

.Evaled master exact value
cos(pi/2 + 100 * i) -1.3440585709080671…E+43 i same (real part 0, correct)
cos(pi/2 + 1000 * i) -8.7923813379875627…E+332 - 9.8503555700852349…E+433 i -9.8503555700852349…E+433 i
cos(pi/2 + 10^5 * i) -1.2526072981145478…E+43328 - 1.4033316802130615…E+43429 i -1.4033316802130615…E+43429 i
sin(pi + 1000 * i) -1.7584766110516030…E+333 - 9.8503555700852349…E+433 i -9.8503555700852349…E+433 i
exp(1000 + pi/2 * i) -1.7584762675975125…E+333 + 1.9700711140170469…E+434 i 1.9700711140170469…E+434 i

The spurious real part is cos of the 100-digit pi/2, about 1e-100, multiplied by cosh(y). Relative to the modulus it is about 1e-101, so it is the residual the library already drops at y = 100. It is dropped there only because the product is below 1 in absolute terms, and from y of about 230 it is not. A residual rule scaled by max(1, |v|) or tested against 0 is absolute below 1: compare #2510, #2511–#2513 and the #2674 ledger rows, which found the same at extreme magnitudes.

#2699 (#2698) makes the overflowing case right: cos(pi/2 + 10^6 i) is -ooi. The finite range above is unchanged by it.

Found by #2699's sweep.

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