-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Base.FastMath.pow_fast(a::Float64, i::Int)
fails for huge i
#53857
Comments
Base.FastMath.pow_fasta, i)
fails for huge i
Base.FastMath.pow_fast(a::Float64, i::Int)
fails for huge i
is |
Actually |
Interesting, I can also reproduce this.
It looks like |
I looked a bit into this. I think the main difference is that With |
Regarding inlining: When the second argument (the power) is known at compile time then inlining simplifies the function significantly. If it is not known then inlining would not help and would probably only make the code larger. |
I'm not sure users would want a different type, though here in this context a is a float, so would not apply. I'm just thinking, when both are integers should it be allowed if known faster, since
For integers it's a routine, but for float in hardware, isn't that why and the main reason? The hardware needs to do something similar, unclear how many functional units it has to do it, so even if it's faster, it might allow less throughput, even if latency is less? [I used to think floats always inherently slower, why in hardware, to make as fast for the user, but at least some simple float operations get smaller in hardware cost/area when you get down to FP4 (vs Int4); as in latest Nvidia hardware. From a paper I read, so assume still calculated, since could be done with a lookup table when that small, then should be as small.] |
Fixes #53857 For `x::Union{Float32,Float64}` and `y::Integer` with `y % Int32 != y` a stack trace appears when calling `@fastmath x^y`. This fix calls `x^y` in those cases, while leaving the other cases as is.
Fixes #53857 For `x::Union{Float32,Float64}` and `y::Integer` with `y % Int32 != y` a stack trace appears when calling `@fastmath x^y`. This fix calls `x^y` in those cases, while leaving the other cases as is.
Fixes JuliaLang#53857 For `x::Union{Float32,Float64}` and `y::Integer` with `y % Int32 != y` a stack trace appears when calling `@fastmath x^y`. This fix calls `x^y` in those cases, while leaving the other cases as is.
From calculus we know
(1 + 1/n) ^ n
converges to Euler'se
.that's quite good! But
Reason is that
Base.FastMath.pow_fast
calls the llvm intrinsicllvm.powi.f64.i32
, for integer second argument and tries to convert the integer to anInt32
, which fails.The text was updated successfully, but these errors were encountered: