Skip to content

Commit 4fc1b9d

Browse files
committed
update ULPError
oscardssmith has been reviewing the `ULPError` code on JuliaLang/julia#59087 So sync the code with the changes there.
1 parent 03037ba commit 4fc1b9d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/common/ULPError.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ module ULPError
2323
end
2424
end
2525
end
26-
# assuming `precision(BigFloat)` is great enough
27-
acc = if accurate isa BigFloat
28-
accurate
26+
acc = if accurate isa Union{Float16, Float32}
27+
# widen for better accuracy when doing so does not impact performance too much
28+
widen(accurate)
2929
else
30-
BigFloat(accurate)::BigFloat
30+
accurate
3131
end
3232
abs(Float32((approximate - acc) / eps(approximate))::Float32)
3333
end

0 commit comments

Comments
 (0)