-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from araujoms/main
Fix inf and nan bugs
- Loading branch information
Showing
9 changed files
with
50 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
@inline function add_dbfp_db(x::DoubleFloat{T}, y::T) where {T<:IEEEFloat} | ||
(isqnan(LO(x)) | isnotfinite(y)) && return add_dbfp_db_nonfinite(x,y) | ||
(isnotfinite(x) | isnotfinite(y)) && return add_dbfp_db_nonfinite(x,y) | ||
return DoubleFloat{T}(add_ddfp_dd(HILO(x), y)) | ||
end | ||
|
||
@inline function sub_dbfp_db(x::DoubleFloat{T}, y::T) where {T<:IEEEFloat} | ||
(isqnan(LO(x)) | isnotfinite(y)) && return sub_dbfp_db_nonfinite(x,y) | ||
(isnotfinite(x) | isnotfinite(y)) && return sub_dbfp_db_nonfinite(x,y) | ||
return DoubleFloat{T}(sub_ddfp_dd(HILO(x), y)) | ||
end | ||
|
||
@inline function mul_dbfp_db(x::DoubleFloat{T}, y::T) where {T<:IEEEFloat} | ||
(isqnan(LO(x)) | isnotfinite(y)) && return mul_dbfp_db_nonfinite(x,y) | ||
(isnotfinite(x) | isnotfinite(y)) && return mul_dbfp_db_nonfinite(x,y) | ||
return DoubleFloat{T}(mul_ddfp_dd(HILO(x), y)) | ||
end | ||
|
||
@inline function dvi_dbfp_db(x::DoubleFloat{T}, y::T) where {T<:IEEEFloat} | ||
(isqnan(LO(x)) | isnotfinite(y)) && return dvi_dbfp_db_nonfinite(x,y) | ||
(isnotfinite(x) | isnotfinite(y)) && return dvi_dbfp_db_nonfinite(x,y) | ||
return DoubleFloat{T}(dvi_ddfp_dd(HILO(x), y)) | ||
end | ||
|
||
@inline function add_dbfp_db_nonfinite(x::DoubleFloat{T}, y::T) where {T<:IEEEFloat} | ||
z = HI(x) + y | ||
return DoubleFloat{T}(z, T(NaN)) | ||
return DoubleFloat{T}(z, z) | ||
end | ||
|
||
@inline function sub_dbfp_db_nonfinite(x::DoubleFloat{T}, y::T) where {T<:IEEEFloat} | ||
z = HI(x) - y | ||
return DoubleFloat{T}(z, T(NaN)) | ||
return DoubleFloat{T}(z, z) | ||
end | ||
|
||
@inline function mul_dbfp_db_nonfinite(x::DoubleFloat{T}, y::T) where {T<:IEEEFloat} | ||
z = HI(x) * y | ||
return DoubleFloat{T}(z, T(NaN)) | ||
return DoubleFloat{T}(z, z) | ||
end | ||
|
||
@inline function dvi_dbfp_db_nonfinite(x::DoubleFloat{T}, y::T) where {T<:IEEEFloat} | ||
z = HI(x) / y | ||
return DoubleFloat{T}(z, T(NaN)) | ||
return DoubleFloat{T}(z, z) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
@inline function add_fpdb_db(x::T, y::DoubleFloat{T}) where {T<:IEEEFloat} | ||
(isnotfinite(x) | isqnan(LO(y))) && return add_fpdb_db_nonfinite(x,y) | ||
(isnotfinite(x) | isnotfinite(y)) && return add_fpdb_db_nonfinite(x,y) | ||
return DoubleFloat{T}(add_fpdd_dd(x, HILO(y))) | ||
end | ||
|
||
@inline function sub_fpdb_db(x::T, y::DoubleFloat{T}) where {T<:IEEEFloat} | ||
(isnotfinite(x) | isqnan(LO(y))) && return sub_fpdb_db_nonfinite(x,y) | ||
(isnotfinite(x) | isnotfinite(y)) && return sub_fpdb_db_nonfinite(x,y) | ||
return DoubleFloat{T}(sub_fpdd_dd(x, HILO(y))) | ||
end | ||
|
||
@inline function mul_fpdb_db(x::T, y::DoubleFloat{T}) where {T<:IEEEFloat} | ||
(isnotfinite(x) | isqnan(LO(y))) && return mul_fpdb_db_nonfinite(x,y) | ||
(isnotfinite(x) | isnotfinite(y)) && return mul_fpdb_db_nonfinite(x,y) | ||
return DoubleFloat{T}(mul_fpdd_dd(x, HILO(y))) | ||
end | ||
|
||
@inline function dvi_fpdb_db(x::T, y::DoubleFloat{T}) where {T<:IEEEFloat} | ||
(isnotfinite(x) | isqnan(LO(y))) && return dvi_fpdb_db_nonfinite(x,y) | ||
(isnotfinite(x) | isnotfinite(y)) && return dvi_fpdb_db_nonfinite(x,y) | ||
return DoubleFloat{T}(dvi_fpdd_dd(x, HILO(y))) | ||
end | ||
|
||
@inline function add_fpdb_db_nonfinite(x::T, y::DoubleFloat{T}) where {T<:IEEEFloat} | ||
z = x + HI(y) | ||
return DoubleFloat{T}(z, T(NaN)) | ||
return DoubleFloat{T}(z, z) | ||
end | ||
|
||
@inline function sub_fpdb_db_nonfinite(x::T, y::DoubleFloat{T}) where {T<:IEEEFloat} | ||
z = x - HI(y) | ||
return DoubleFloat{T}(z, T(NaN)) | ||
return DoubleFloat{T}(z, z) | ||
end | ||
|
||
@inline function mul_fpdb_db_nonfinite(x::T, y::DoubleFloat{T}) where {T<:IEEEFloat} | ||
z = x * HI(y) | ||
return DoubleFloat{T}(z, T(NaN)) | ||
return DoubleFloat{T}(z, z) | ||
end | ||
|
||
@inline function dvi_fpdb_db_nonfinite(x::T, y::DoubleFloat{T}) where {T<:IEEEFloat} | ||
z = x / HI(y) | ||
return DoubleFloat{T}(z, T(NaN)) | ||
return DoubleFloat{T}(z, z) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters