Skip to content

Commit 10cf7f7

Browse files
authored
Add floatmin2 overrides in misc.jl
1 parent 8295987 commit 10cf7f7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/extras/misc.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ end
6262
function Base.:(-)(m::Matrix{DoubleFloat{T}}, x::T) where {T}
6363
return m .- x
6464
end
65+
66+
# for getting fast floatmin2, used in Givens rotations in LinearAlgebra
67+
# these values were computed with the existing code saved
68+
# floatmin2(::Type{T}) where {T} = (twopar = 2one(T); twopar^trunc(Integer,log(floatmin(T)/eps(T))/log(twopar)/twopar))
69+
LinearAlgebra.floatmin2(::Type{Double64}) = Double64(reinterpret(Float64, 0x2350000000000000), 0.0)
70+
LinearAlgebra.floatmin2(::Type{Double32}) = Double32(reinterpret(Float32, 0x2c000000), 0.0f0)

0 commit comments

Comments
 (0)