-
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 #195 from araujoms/incgamma
add logabsgamma and unrelated fixes
- Loading branch information
Showing
7 changed files
with
42 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
erf(x::Double64) = Double64Float128(erf, x) | ||
erfc(x::Double64) = Double64Float128(erfc, x) | ||
gamma(x::Double64) = Double64Float128(gamma, x) | ||
lgamma(x::Double64) = Double64Float128(lgamma, x) | ||
loggamma(x::Double64) = Double64Float128(lgamma, x) | ||
|
||
erf(x::Double32) = Double32Float128(erf, x) | ||
erfc(x::Double32) = Double32Float128(erfc, x) | ||
gamma(x::Double32) = Double32Float128(gamma, x) | ||
lgamma(x::Double32) = Double32Float128(lgamma, x) | ||
loggamma(x::Double32) = Double32Float128(lgamma, x) | ||
|
||
erf(x::Double16) = Double16Float128(erf, x) | ||
erfc(x::Double16) = Double16Float128(erfc, x) | ||
gamma(x::Double16) = Double16Float128(gamma, x) | ||
lgamma(x::Double16) = Double16Float128(lgamma, x) | ||
loggamma(x::Double16) = Double16Float128(lgamma, x) | ||
|
||
function logabsgamma(x::DoubleFloat{T}) where {T<:IEEEFloat} | ||
result = logabsgamma(Float128(x)) | ||
return DoubleFloat{T}(result[1]), result[2] | ||
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,17 +1,17 @@ | ||
@testset "fma" begin | ||
|
||
@test HILO(fma(Float64(pi), Float64(phi), Double64(gamma))) == (5.660419357216792, 4.1344240638440936e-16) | ||
@test HILO(fma(Float64(pi), Double64(phi), Float64(gamma))) == (5.660419357216792, 2.477303893634162e-16) | ||
@test HILO(fma(Double64(pi), Float64(phi), Float64(gamma))) == (5.660419357216793, -2.7164108363986695e-16) | ||
@test HILO(fma(Double64(pi), Double64(phi), Float64(gamma))) == (5.660419357216793, -4.422960158132908e-16) | ||
@test HILO(fma(Double64(pi), Float64(phi), Double64(gamma))) == (5.660419357216793, -2.765839987922976e-16) | ||
@test HILO(fma(Double64(pi), Double64(phi), Double64(gamma))) == (5.660419357216792, 4.4093948873440384e-16) | ||
@test HILO(fma(Float64(pi), Float64(phi), Double64(eulergamma))) == (5.660419357216792, 4.1344240638440936e-16) | ||
@test HILO(fma(Float64(pi), Double64(phi), Float64(eulergamma))) == (5.660419357216792, 2.477303893634162e-16) | ||
@test HILO(fma(Double64(pi), Float64(phi), Float64(eulergamma))) == (5.660419357216793, -2.7164108363986695e-16) | ||
@test HILO(fma(Double64(pi), Double64(phi), Float64(eulergamma))) == (5.660419357216793, -4.422960158132908e-16) | ||
@test HILO(fma(Double64(pi), Float64(phi), Double64(eulergamma))) == (5.660419357216793, -2.765839987922976e-16) | ||
@test HILO(fma(Double64(pi), Double64(phi), Double64(eulergamma))) == (5.660419357216792, 4.4093948873440384e-16) | ||
|
||
@test HILO(muladd(Float64(pi), Float64(phi), Double64(gamma))) == (5.660419357216792, 4.1344240638440936e-16) | ||
@test HILO(muladd(Float64(pi), Double64(phi), Float64(gamma))) == (5.660419357216792, 2.477303893634162e-16) | ||
@test HILO(muladd(Double64(pi), Float64(phi), Float64(gamma))) == (5.660419357216793, -2.7164108363986695e-16) | ||
@test HILO(muladd(Double64(pi), Double64(phi), Float64(gamma))) == (5.660419357216793, -4.422960158132908e-16) | ||
@test HILO(muladd(Double64(pi), Float64(phi), Double64(gamma))) == (5.660419357216793, -2.765839987922976e-16) | ||
@test HILO(muladd(Double64(pi), Double64(phi), Double64(gamma))) == (5.660419357216792, 4.4093948873440384e-16) | ||
@test HILO(muladd(Float64(pi), Float64(phi), Double64(eulergamma))) == (5.660419357216792, 4.1344240638440936e-16) | ||
@test HILO(muladd(Float64(pi), Double64(phi), Float64(eulergamma))) == (5.660419357216792, 2.477303893634162e-16) | ||
@test HILO(muladd(Double64(pi), Float64(phi), Float64(eulergamma))) == (5.660419357216793, -2.7164108363986695e-16) | ||
@test HILO(muladd(Double64(pi), Double64(phi), Float64(eulergamma))) == (5.660419357216793, -4.422960158132908e-16) | ||
@test HILO(muladd(Double64(pi), Float64(phi), Double64(eulergamma))) == (5.660419357216793, -2.765839987922976e-16) | ||
@test HILO(muladd(Double64(pi), Double64(phi), Double64(eulergamma))) == (5.660419357216792, 4.4093948873440384e-16) | ||
|
||
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 +1,18 @@ | ||
using SpecialFunctions | ||
|
||
@testset "special functions" begin | ||
# The intention here is not to check the accuracy of the libraries, | ||
# rather the sanity of library calls: | ||
piq = Double64(pi) | ||
halfq = Double64(0.5) | ||
@test gamma(halfq) ≈ sqrt(piq) | ||
for func in (erf, erfc, besselj0, besselj1, bessely0, bessely1, loggamma) | ||
@test func(halfq) ≈ func(0.5) | ||
end | ||
for func in (bessely, besselj) | ||
@test func(3,halfq) ≈ func(3,0.5) | ||
end | ||
@test gamma(Double64(2),3) ≈ gamma(2,3) | ||
@test all(logabsgamma(Double64(-0.5)) .≈ logabsgamma(-0.5)) | ||
@test all(logabsgamma(Double64(-1.5)) .≈ logabsgamma(-1.5)) | ||
end |