Skip to content

Commit 833e6bf

Browse files
authored
Remove checked conversions in two more cases. NFC. (#34406)
Like #34398, but in a different place. I also realized there was a good reason to do this beside personal preference: Once we start tracking nothrow more closely (to optimize try/catch, etc.), we we'll want to make sure not to emit error paths that the julia optimizer itself can't eliminate.
1 parent 4254045 commit 833e6bf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

base/ryu/shortest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ integer. If a `maxsignif` argument is provided, then `b < maxsignif`.
88
U = uinttype(T)
99
uf = reinterpret(U, f)
1010
m = uf & significand_mask(T)
11-
e = Int((uf & exponent_mask(T)) >> significand_bits(T))
11+
e = ((uf & exponent_mask(T)) >> significand_bits(T)) % Int
1212

1313
## Step 1
1414
# mf * 2^ef == f

base/special/rem_pio2.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ function paynehanek(x::Float64)
138138
X = (u & significand_mask(Float64)) | (one(UInt64) << significand_bits(Float64))
139139
# Get k from formula above
140140
# k = exponent(x)-52
141-
k = Int((u & exponent_mask(Float64)) >> significand_bits(Float64)) - exponent_bias(Float64) - significand_bits(Float64)
141+
raw_exponent = ((u & exponent_mask(Float64)) >> significand_bits(Float64)) % Int
142+
k = raw_exponent - exponent_bias(Float64) - significand_bits(Float64)
142143

143144
# 2. Let α = 1/2π, then:
144145
#

0 commit comments

Comments
 (0)