Skip to content

Commit 0ceff46

Browse files
committed
hardware indep. isinf for hardware floats
1 parent 1ea0de1 commit 0ceff46

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

base/float.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ isfinite(x::Real) = decompose(x)[3] != 0
504504
isfinite(x::Integer) = true
505505

506506
isinf(x::Real) = !isnan(x) & !isfinite(x)
507+
isinf{T<:Union{Float16,Float32,Float64}}(x::T) = (reinterpret(Unsigned, x) & ~sign_mask(T)) == exponent_mask(T)
508+
507509

508510
## hashing small, built-in numeric types ##
509511

0 commit comments

Comments
 (0)