File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1217,7 +1217,8 @@ end
1217
1217
# this method is only reliable for -2^20 < n < 2^20 (cf. #53881 #53886)
1218
1218
@assume_effects :terminates_locally @noinline function pow_body (x:: Float64 , n:: Integer )
1219
1219
y = 1.0
1220
- xnlo = ynlo = 0.0
1220
+ xnlo = - 0.0
1221
+ ynlo = 0.0
1221
1222
n == 3 && return x* x* x # keep compatibility with literal_pow
1222
1223
if n < 0
1223
1224
rx = inv (x)
Original file line number Diff line number Diff line change @@ -1505,7 +1505,19 @@ end
1505
1505
@test E^ n == Inf
1506
1506
@test E^ float (n) == Inf
1507
1507
1508
- # #55633
1508
+ # issue #55831
1509
+ @testset " literal pow zero sign" begin
1510
+ @testset " T: $T " for T ∈ (Float16, Float32, Float64, BigFloat)
1511
+ @testset " literal `-1`" begin
1512
+ @test - 0.0 === Float64 (T (- Inf )^- 1 )
1513
+ end
1514
+ @testset " `Int(-1)`" begin
1515
+ @test - 0.0 === Float64 (T (- Inf )^ Int (- 1 ))
1516
+ end
1517
+ end
1518
+ end
1519
+
1520
+ # issue #55633
1509
1521
struct Issue55633_1 <: Number end
1510
1522
struct Issue55633_3 <: Number end
1511
1523
struct Issue55633_9 <: Number end
You can’t perform that action at this time.
0 commit comments