Skip to content

Commit d7166fc

Browse files
committed
Add Compat to finally get 0.6/0.7 compat write
1 parent f113663 commit d7166fc

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
julia 0.6
2+
Compat 0.40.0
23
BinDeps

src/DecFP.jl

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
module DecFP
2+
3+
using Compat
4+
5+
if !(VERSION < v"0.7.0-DEV.3026")
6+
using Printf
7+
end
8+
9+
if !(VERSION < v"0.7.0-DEV.2813")
10+
using Unicode
11+
end
12+
213
export Dec32, Dec64, Dec128, @d_str, @d32_str, @d64_str, @d128_str
314

415
const libbid = joinpath(dirname(@__FILE__), "..", "deps", "libbid$(Sys.WORD_SIZE)")
@@ -8,22 +19,6 @@ const _buffer = fill(0x00, 1024)
819
import Base.promote_rule
920
import Base.Grisu.DIGITS
1021

11-
# https://github.com/JuliaLang/julia/pull/20005
12-
if VERSION < v"0.7.0-DEV.896"
13-
Base.InexactError(name::Symbol, T, val) = InexactError()
14-
end
15-
16-
# https://github.com/JuliaLang/julia/pull/22751
17-
if VERSION < v"0.7.0-DEV.924"
18-
Base.DomainError(val) = DomainError()
19-
Base.DomainError(val, msg) = DomainError()
20-
end
21-
22-
# https://github.com/JuliaLang/julia/pull/222761
23-
if VERSION < v"0.7.0-DEV.1285"
24-
Base.OverflowError(msg) = OverflowError()
25-
end
26-
2722
# global pointers and dicts must be initialized at runtime (via __init__)
2823
function __init__()
2924
global const rounding = cglobal((:__bid_IDEC_glbround, libbid), Cuint) # rounding mode
@@ -226,7 +221,7 @@ for w in (32,64,128)
226221
end
227222
end
228223

229-
for c in (, :e, , :catalan, )
224+
for c in (, :e, :, :γ, :catalan, )
230225
@eval begin
231226
Base.convert(::Type{$BID}, ::Irrational{$(QuoteNode(c))}) = $(_parse(T, setprecision(256) do
232227
string(BigFloat(isdefined(Base, :MathConstants) ? eval(Base.MathConstants, c) : eval(c)))

test/runtests.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
using DecFP
2-
using Base.Test
2+
3+
@static if VERSION < v"0.7.0-DEV.2005"
4+
using Base.Test
5+
else
6+
using Test
7+
end
8+
if !(VERSION < v"0.7.0-DEV.3026")
9+
using Printf
10+
end
11+
if !(VERSION < v"0.7.0-DEV.1592")
12+
using Base.MathConstants
13+
end
314

415
@test unsafe_load(DecFP.flags) == 0
516

0 commit comments

Comments
 (0)