Skip to content

incorrect promotion of rational types in eigvals etc #491

Closed
JuliaLang/julia
#24936
@stevengj

Description

As pointed out on discourse, the eigvals functions and a number of other linalg functions are incorrectly promoting rationals to Float32 rather than Float64.

They are calling promote_type(Float32, typeof(one(T)/norm(one(T)))). The Float32 was added by @andreasnoack in JuliaLang/julia#5526 to ensure that Float16 data was promoted to Float32, and the norm call was added by @andreasnoack in JuliaLang/julia#5652, at which point he changed norm(::Rational) to produce a floating-point result. However, the norm(::Rational) method was subsequently changed back to produce a rational result, at which point this bug was introduced.

A simple fix would be to add a float call here (and in other functions that use this promotion scheme).

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions