Skip to content

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

@nsajko

Description

@nsajko

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcomplexComplex numbersrationalsThe Rational type and values thereof

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions