Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
14f69cf
1
Parent(s):
e2ae8ef
Make fast power portable
Browse files- julia/operators.jl +3 -2
julia/operators.jl
CHANGED
@@ -4,7 +4,8 @@ import SpecialFunctions: gamma, lgamma, erf, erfc, beta
|
|
4 |
import Base.FastMath: sqrt_llvm_fast, neg_float_fast,
|
5 |
add_float_fast, sub_float_fast, mul_float_fast, div_float_fast, rem_float_fast,
|
6 |
eq_float_fast, ne_float_fast, lt_float_fast, le_float_fast,
|
7 |
-
sign_fast, abs_fast, log_fast, log2_fast, log10_fast, sqrt_fast
|
|
|
8 |
|
9 |
# Implicitly defined:
|
10 |
#binary: mod
|
@@ -15,7 +16,7 @@ import Base.FastMath: sqrt_llvm_fast, neg_float_fast,
|
|
15 |
plus(x::Float32, y::Float32)::Float32 = add_float_fast(x, y) #Do not change the name of this operator.
|
16 |
sub(x::Float32, y::Float32)::Float32 = sub_float_fast(x, y) #Do not change the name of this operator.
|
17 |
mult(x::Float32, y::Float32)::Float32 = mul_float_fast(x, y) #Do not change the name of this operator.
|
18 |
-
pow(x::Float32, y::Float32)::Float32 = sign_fast(x)*
|
19 |
div(x::Float32, y::Float32)::Float32 = div_float_fast(x, y)
|
20 |
logm(x::Float32)::Float32 = log_fast(abs_fast(x) + 1f-8)
|
21 |
logm2(x::Float32)::Float32 = log2_fast(abs_fast(x) + 1f-8)
|
|
|
4 |
import Base.FastMath: sqrt_llvm_fast, neg_float_fast,
|
5 |
add_float_fast, sub_float_fast, mul_float_fast, div_float_fast, rem_float_fast,
|
6 |
eq_float_fast, ne_float_fast, lt_float_fast, le_float_fast,
|
7 |
+
sign_fast, abs_fast, log_fast, log2_fast, log10_fast, sqrt_fast,
|
8 |
+
pow_fast
|
9 |
|
10 |
# Implicitly defined:
|
11 |
#binary: mod
|
|
|
16 |
plus(x::Float32, y::Float32)::Float32 = add_float_fast(x, y) #Do not change the name of this operator.
|
17 |
sub(x::Float32, y::Float32)::Float32 = sub_float_fast(x, y) #Do not change the name of this operator.
|
18 |
mult(x::Float32, y::Float32)::Float32 = mul_float_fast(x, y) #Do not change the name of this operator.
|
19 |
+
pow(x::Float32, y::Float32)::Float32 = sign_fast(x)*pow_fast(abs(x), y)
|
20 |
div(x::Float32, y::Float32)::Float32 = div_float_fast(x, y)
|
21 |
logm(x::Float32)::Float32 = log_fast(abs_fast(x) + 1f-8)
|
22 |
logm2(x::Float32)::Float32 = log2_fast(abs_fast(x) + 1f-8)
|