diff --git a/base/gmp.jl b/base/gmp.jl index 5e339929b88cc..8c4a14102689e 100644 --- a/base/gmp.jl +++ b/base/gmp.jl @@ -443,9 +443,6 @@ end ^(x::Integer, y::BigInt ) = bigint_pow(BigInt(x), y) ^(x::Bool , y::BigInt ) = Base.power_by_squaring(x, y) -# override default inlining of x^2 and x^3 etc. -^{p}(x::BigInt, ::Type{Val{p}}) = x^p - function powermod(x::BigInt, p::BigInt, m::BigInt) r = BigInt() ccall((:__gmpz_powm, :libgmp), Void, diff --git a/base/irrationals.jl b/base/irrationals.jl index 55390ac126738..1d61d426a4f2f 100644 --- a/base/irrationals.jl +++ b/base/irrationals.jl @@ -212,7 +212,6 @@ catalan for T in (Irrational, Rational, Integer, Number) ^(::Irrational{:e}, x::T) = exp(x) end -^{p}(::Irrational{:e}, ::Type{Val{p}}) = exp(p) log(::Irrational{:e}) = 1 # use 1 to correctly promote expressions like log(x)/log(e) log(::Irrational{:e}, x::Number) = log(x) diff --git a/base/math.jl b/base/math.jl index 3831ed2831961..4901c7baa5466 100644 --- a/base/math.jl +++ b/base/math.jl @@ -698,7 +698,7 @@ end @inline ^(x::Float64, y::Integer) = x ^ Float64(y) @inline ^(x::Float32, y::Integer) = x ^ Float32(y) @inline ^(x::Float16, y::Integer) = Float16(Float32(x) ^ Float32(y)) -@inline ^{p}(x::Float16, ::Type{Val{p}}) = Float16(Float32(x) ^ Val{p}) +@inline literal_pow{p}(::typeof(^), x::Float16, ::Type{Val{p}}) = Float16(literal_pow(^,Float32(x),Val{p})) function angle_restrict_symm(theta) const P1 = 4 * 7.8539812564849853515625e-01 diff --git a/base/mpfr.jl b/base/mpfr.jl index 18529931004a4..808de3a0ca3c7 100644 --- a/base/mpfr.jl +++ b/base/mpfr.jl @@ -504,9 +504,6 @@ end ^(x::BigFloat, y::Integer) = typemin(Clong) <= y <= typemax(Clong) ? x^Clong(y) : x^BigInt(y) ^(x::BigFloat, y::Unsigned) = typemin(Culong) <= y <= typemax(Culong) ? x^Culong(y) : x^BigInt(y) -# override default inlining of x^2 etc. -^{p}(x::BigFloat, ::Type{Val{p}}) = x^p - for f in (:exp, :exp2, :exp10, :expm1, :cosh, :sinh, :tanh, :sech, :csch, :coth, :cbrt) @eval function $f(x::BigFloat) z = BigFloat() diff --git a/test/float16.jl b/test/float16.jl index 85356aa2cdb95..10e741336c53c 100644 --- a/test/float16.jl +++ b/test/float16.jl @@ -61,6 +61,7 @@ g = Float16(1.) @test f*g === Float16(2f0) @test f/g === Float16(2f0) @test f^g === Float16(2f0) +@test f^1 === Float16(2f0) @test f^-g === Float16(0.5f0) @test f + 2 === Float16(4f0) diff --git a/test/math.jl b/test/math.jl index 372bcf0e10a24..2dab2c3f07278 100644 --- a/test/math.jl +++ b/test/math.jl @@ -128,6 +128,7 @@ end yi = 4 @testset "Random values" begin @test x^y ≈ big(x)^big(y) + @test x^1 === x @test x^yi ≈ big(x)^yi @test acos(x) ≈ acos(big(x)) @test acosh(1+x) ≈ acosh(big(1+x))