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

precision(Union{Float16,Float32}) recurs without bound (until StackOverflowError) #52909

Closed
nsajko opened this issue Jan 15, 2024 · 1 comment · Fixed by #52910
Closed

precision(Union{Float16,Float32}) recurs without bound (until StackOverflowError) #52909

nsajko opened this issue Jan 15, 2024 · 1 comment · Fixed by #52910
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@nsajko
Copy link
Contributor

nsajko commented Jan 15, 2024

julia> precision(Union{Float16,Float32})
ERROR: StackOverflowError:
Stacktrace:
     [1] _precision(x::Type, base::Int64)
       @ Base ./float.jl:844
     [2] _precision(x::Type)
       @ Base ./float.jl:843
--- the above 2 lines are repeated 26657 more times ---
 [53317] _precision(x::Type, base::Int64)
       @ Base ./float.jl:844

julia> versioninfo()
Julia Version 1.11.0-DEV.1276
Commit fc6295df630 (2024-01-15 05:47 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

Fix incoming.

@gbaraldi
Copy link
Member

gbaraldi commented Jan 15, 2024

This should probably error from the start. Probably even a method error

nsajko added a commit to nsajko/julia that referenced this issue Jan 15, 2024
Make the single-argument method of `_precision` into its own function.

Now `precision(Union{Float16,Float32})` results in a `MethodError`
instead of in a `StackOverflowError`.

Fixes JuliaLang#52909
nsajko added a commit to nsajko/julia that referenced this issue Jan 15, 2024
Make the single-argument method of `_precision` into its own function.

Now `precision(Union{Float16,Float32})` results in a `MethodError`
instead of in a `StackOverflowError`.

Fixes JuliaLang#52909
@nsajko nsajko added the bug Indicates an unexpected problem or unintended behavior label Jan 15, 2024
nsajko added a commit to nsajko/julia that referenced this issue Jan 17, 2024
Make the single-argument method of `_precision` into its own function.

Now `precision(Union{Float16,Float32})` will result in a `MethodError`
instead of in a `StackOverflowError`.

Fixes JuliaLang#52909
gbaraldi pushed a commit that referenced this issue Jan 23, 2024
Make the single-argument method of `_precision` into its own function.

Now `precision(Union{Float16,Float32})` results in a `MethodError`
instead of in a `StackOverflowError`.

Fixes #52909
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants