Skip to content

Commit

Permalink
Use Tang's algorithm for log and log1p. Adds basic tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne committed Apr 23, 2015
1 parent 7e63e6a commit ef35957
Show file tree
Hide file tree
Showing 3 changed files with 427 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ exp10(x::Integer) = exp10(float(x))
@vectorize_1arg Number exp10

# functions that return NaN on non-NaN argument for domain error
for f in (:sin, :cos, :tan, :asin, :acos, :acosh, :atanh, :log, :log2, :log10,
:lgamma, :log1p)
for f in (:sin, :cos, :tan, :asin, :acos, :acosh, :atanh, :log2, :log10,
:lgamma)
@eval begin
($f)(x::Float64) = nan_dom_err(ccall(($(string(f)),libm), Float64, (Float64,), x), x)
($f)(x::Float32) = nan_dom_err(ccall(($(string(f,"f")),libm), Float32, (Float32,), x), x)
Expand Down Expand Up @@ -369,7 +369,7 @@ function mod2pi(x::Int64)
end

# More special functions

include("special/log.jl")
include("special/trig.jl")
include("special/bessel.jl")
include("special/erf.jl")
Expand Down
Loading

0 comments on commit ef35957

Please sign in to comment.