Skip to content

Commit 9efdd14

Browse files
Merge pull request #121 from JuliaMath/infnorm
Infnorm
2 parents 4999a18 + d48f8cf commit 9efdd14

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
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.1.15"
7+
version = "1.1.16"
88

99
[deps]
1010
GenericSVD = "01680d73-4ee2-5a08-a1aa-533608c188bb"

src/math/linearalgebra/support.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ end
88
return r === c
99
end
1010

11-
function norm(v::Array{DoubleFloat{T},N}, p::Real=2.0) where {N, T<:IEEEFloat}
11+
function LinearAlgebra.norm(v::Array{DoubleFloat{T},N}, p::Real=2.0) where {N, T<:IEEEFloat}
1212
isempty(v) && return zero(DoubleFloat{T})
1313

1414
if isinf(p)
@@ -22,7 +22,7 @@ function norm(v::Array{DoubleFloat{T},N}, p::Real=2.0) where {N, T<:IEEEFloat}
2222
end
2323
end
2424

25-
function norm(v::Array{Complex{DoubleFloat{T}},N}, p::Real=2.0) where {N, T<:IEEEFloat}
25+
function LinearAlgebra.norm(v::Array{Complex{DoubleFloat{T}},N}, p::Real=2.0) where {N, T<:IEEEFloat}
2626
isempty(v) && return zero(DoubleFloat{T})
2727

2828
if isinf(p)

src/math/prearith/prearith.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,21 @@ ulp(::Type{D}) where {T<:AbstractFloat, D<:DoubleFloat{T}} = D(posulp(poslulp(on
100100

101101

102102
function Base.Math.nextfloat(x::DoubleFloat{T}) where {T<:IEEEFloat}
103-
!isfinite(x) && return(x)
104-
if !iszero(LO(x))
103+
if !isfinite(x)
104+
isnan(x) && return x
105+
signbit(x) ? floatmin(DoubleFloat{T}) : x
106+
elseif !iszero(LO(x))
105107
DoubleFloat{T}(HI(x)) + nextfloat(LO(x))
106108
else
107109
DoubleFloat{T}(HI(x), ulp(ulp(HI(x))))
108110
end
109111
end
110112

111113
function Base.Math.prevfloat(x::DoubleFloat{T}) where {T<:IEEEFloat}
112-
!isfinite(x) && return(x)
113-
if !iszero(LO(x))
114+
if !isfinite(x)
115+
isnan(x) && return x
116+
signbit(x) ? x : floatmax(DoubleFloat{T})
117+
elseif !iszero(LO(x))
114118
DoubleFloat{T}(HI(x)) + prevfloat(LO(x))
115119
else
116120
DoubleFloat{T}(HI(x), -ulp(ulp(HI(x))))

0 commit comments

Comments
 (0)