Skip to content

Uncaught overflow for gcd(typemin(T), zero(T)) where T<:Signed #33781

Closed
@ivirshup

Description

@ivirshup

Hi! Here's a quick example of the issue:

julia> gcd(typemin(Int8), zero(Int8))
-128

Since gcd(typemin(T), typemin(T)) where T<:Signed (per #15228) is an overflow error, and results should be positive I think this is a bug. I'd like to open a PR to fix this (I think an abs to be swapped out with a checked_abs). Does this sound reasonable?

Metadata

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