Skip to content

Commit d4a2e48

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 4dbb825 + f722202 commit d4a2e48

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ keywords = ["math", "floating-point", "doubledouble", "extended-precision", "acc
44
license = "MIT"
55
desc = "extended precision floating point types using value pairs"
66
repo = "https://github.com/JuliaMath/DoubleFloats.jl.git"
7-
version = "1.2.1"
7+
version = "1.2.2"
88

99
[deps]
1010
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/extras/misc.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,10 @@ 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)
71+
LinearAlgebra.floatmin2(::Type{Double16}) = Double16(Float16(8.0), Float16(0.0))

test/specialvalues.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@ end
6161
@test isnan(asech(T(NaN)))
6262
@test isnan(acoth(T(NaN)))
6363
end
64+
65+
@testset "floatmin2 $T" for T in (Double16, Double32, Double64)
66+
trueval = (twopar = 2one(T); twopar^trunc(Integer,log(floatmin(T)/eps(T))/log(twopar)/twopar))
67+
@test LinearAlgebra.floatmin2(T) == trueval
68+
end

0 commit comments

Comments
 (0)