You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 10, 2023. It is now read-only.
presently sqrt(Double(0.0)) and sign(Double(0.0)) throw an error.
Possible remedy for sqrt is to change
# Dekker sqrt2
function sqrt{T}(x::Double{T})
if x.hi <= 0
throw(DomainError("sqrt will only return a complex result if called with a complex argument."))
end
c = sqrt(x.hi)
u = Single(c)*Single(c)
cc = (((x.hi - u.hi) - u.lo) + x.lo)*map(typeof(x.hi),0.5)/c
double(c,cc)
end
into
# Dekker sqrt2
function sqrt{T}(x::Double{T})
if x.hi = 0
return Double(zero(T))
end
if x.hi < 0
throw(DomainError("sqrt will only return a complex result if called with a complex argument."))
end
c = sqrt(x.hi)
u = Single(c)*Single(c)
cc = (((x.hi - u.hi) - u.lo) + x.lo)*map(typeof(x.hi),0.5)/c
double(c,cc)
end
Simon,
presently sqrt(Double(0.0)) and sign(Double(0.0)) throw an error.
Possible remedy for sqrt is to change
into
Cheers, Ivan