Skip to content

Commit 89bb3c2

Browse files
authored
Merge pull request #38 from RalphAS/ras/specfun3
Return SpecialFunctions to Requires management, w/o warnings
2 parents 808d7ba + 8a08fb5 commit 89bb3c2

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ julia = "1.0"
77

88
[deps]
99
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
10-
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
10+
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1111

1212
[extras]
1313
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

src/Quadmath.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module Quadmath
2+
using Requires
23

34
export Float128, ComplexF128, Inf128
45

@@ -105,6 +106,12 @@ reinterpret(::Type{Int128}, x::Float128) =
105106
reinterpret(::Type{Float128}, x::Int128) =
106107
reinterpret(Float128, reinterpret(UInt128, x))
107108

109+
function __init__()
110+
@require SpecialFunctions="276daf66-3868-5448-9aa4-cd146d93841b" begin
111+
include("specfun.jl")
112+
end
113+
end
114+
108115

109116
sign_mask(::Type{Float128}) = 0x8000_0000_0000_0000_0000_0000_0000_0000
110117
exponent_mask(::Type{Float128}) = 0x7fff_0000_0000_0000_0000_0000_0000_0000
@@ -579,7 +586,6 @@ end
579586
print(io::IO, b::Float128) = print(io, string(b))
580587
show(io::IO, b::Float128) = print(io, string(b))
581588

582-
include("specfun.jl")
583589
include("printf.jl")
584590

585591
end # module Quadmath

src/specfun.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
import SpecialFunctions
1+
import .SpecialFunctions
2+
import .SpecialFunctions: erf, erfc, besselj0, besselj1, bessely0, bessely1,
3+
besselj, bessely, gamma, lgamma
24

3-
SpecialFunctions.erf(x::Float128) =
5+
erf(x::Float128) =
46
Float128(@ccall(libquadmath.erfq(x::Cfloat128)::Cfloat128))
5-
SpecialFunctions.erfc(x::Float128) =
7+
erfc(x::Float128) =
68
Float128(@ccall(libquadmath.erfcq(x::Cfloat128)::Cfloat128))
79

8-
SpecialFunctions.besselj0(x::Float128) =
10+
besselj0(x::Float128) =
911
Float128(@ccall(libquadmath.j0q(x::Cfloat128)::Cfloat128))
10-
SpecialFunctions.besselj1(x::Float128) =
12+
besselj1(x::Float128) =
1113
Float128(@ccall(libquadmath.j1q(x::Cfloat128)::Cfloat128))
1214

13-
SpecialFunctions.bessely0(x::Float128) =
15+
bessely0(x::Float128) =
1416
Float128(@ccall(libquadmath.y0q(x::Cfloat128)::Cfloat128))
15-
SpecialFunctions.bessely1(x::Float128) =
17+
bessely1(x::Float128) =
1618
Float128(@ccall(libquadmath.y1q(x::Cfloat128)::Cfloat128))
1719

18-
SpecialFunctions.besselj(n::Integer, x::Float128) =
20+
besselj(n::Integer, x::Float128) =
1921
Float128(@ccall(libquadmath.jnq(n::Cint, x::Cfloat128)::Cfloat128))
20-
SpecialFunctions.bessely(n::Integer, x::Float128) =
22+
bessely(n::Integer, x::Float128) =
2123
Float128(@ccall(libquadmath.ynq(n::Cint, x::Cfloat128)::Cfloat128))
2224

23-
SpecialFunctions.gamma(x::Float128) =
25+
gamma(x::Float128) =
2426
Float128(@ccall(libquadmath.tgammaq(x::Cfloat128)::Cfloat128))
25-
SpecialFunctions.lgamma(x::Float128) =
27+
lgamma(x::Float128) =
2628
Float128(@ccall(libquadmath.lgammaq(x::Cfloat128)::Cfloat128))

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Quadmath, SpecialFunctions
2-
using Random, Test
1+
using Test, Random
2+
using Quadmath
33

44
@testset "fp decomp" begin
55
y = Float128(2.0)

test/specfun.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
using SpecialFunctions
2+
13
@testset "special functions" begin
24
# The intention here is not to check the accuracy of the libraries,
35
# rather the sanity of library calls:
46
piq = Float128(pi)
57
halfq = Float128(0.5)
68
@test gamma(halfq) sqrt(piq)
7-
for func in (erf, erfc,
8-
besselj0, besselj1,
9-
bessely0, bessely1, lgamma)
9+
for func in (erf, erfc, besselj0, besselj1, bessely0, bessely1, lgamma)
1010
@test func(halfq) func(0.5)
1111
end
1212
for func in (bessely, besselj)

0 commit comments

Comments
 (0)