Skip to content

Commit d9e3c0e

Browse files
committed
random: fix zero edge case
The current code is `zero(DoubleFloat(T))`, which seems like a typo of `DoubleFloat(zero(T))`. Even though this branch is reached only rarely/never, this change should help Julia generate better code.
1 parent 854a6c2 commit d9e3c0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/extras/random.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function rand(rng::AbstractRNG, ::Random.SamplerTrivial{Random.CloseOpen01{Doubl
33
lo = rand(rng, T)
44
if hi === zero(T)
55
if lo === zero(T)
6-
return zero(DoubleFloat(T))
6+
return DoubleFloat(zero(T))
77
end
88
hi, lo = lo, hi
99
end

0 commit comments

Comments
 (0)