Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the //(::Number, ::Complex) method is not correct when the second argument is zero or infinite #56245

Open
nsajko opened this issue Oct 19, 2024 · 0 comments · May be fixed by #56478
Open

the //(::Number, ::Complex) method is not correct when the second argument is zero or infinite #56245

nsajko opened this issue Oct 19, 2024 · 0 comments · May be fixed by #56478
Labels
bug Indicates an unexpected problem or unintended behavior complex Complex numbers rationals The Rational type and values thereof

Comments

@nsajko
Copy link
Contributor

nsajko commented Oct 19, 2024

This is the method:

//(x::Number, y::Complex) = x*conj(y)//abs2(y)

The math behind the transformation incorrectly assumes y is finite and nonzero.

xref #53435, which concerns overflow caused by the same oneliner.

Test:

using Test

@testset "exact division by an infinite complex number" begin
    for y  (1 // 0, -1 // 0)
        @test (7 // complex(y)) == (7 // y)
    end
end

Resulting in:

Test Summary:                                       | Error  Total  Time
exact division by a zero or infinite complex number |     3      3  1.6s
ERROR: Some tests did not pass: 0 passed, 0 failed, 3 errored, 0 broken.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior complex Complex numbers rationals The Rational type and values thereof
Projects
None yet
1 participant