Skip to content

Commit

Permalink
Merge pull request #51 from stevengj/jq/0.7
Browse files Browse the repository at this point in the history
Add Compat to finally get 0.6/0.7 compat write
  • Loading branch information
quinnj authored Dec 19, 2017
2 parents ec6bffe + d7166fc commit 2550bca
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
julia 0.6
Compat 0.40.0
BinDeps
29 changes: 12 additions & 17 deletions src/DecFP.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
module DecFP

using Compat

if !(VERSION < v"0.7.0-DEV.3026")
using Printf
end

if !(VERSION < v"0.7.0-DEV.2813")
using Unicode
end

export Dec32, Dec64, Dec128, @d_str, @d32_str, @d64_str, @d128_str

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

# https://github.com/JuliaLang/julia/pull/20005
if VERSION < v"0.7.0-DEV.896"
Base.InexactError(name::Symbol, T, val) = InexactError()
end

# https://github.com/JuliaLang/julia/pull/22751
if VERSION < v"0.7.0-DEV.924"
Base.DomainError(val) = DomainError()
Base.DomainError(val, msg) = DomainError()
end

# https://github.com/JuliaLang/julia/pull/222761
if VERSION < v"0.7.0-DEV.1285"
Base.OverflowError(msg) = OverflowError()
end

# global pointers and dicts must be initialized at runtime (via __init__)
function __init__()
global const rounding = cglobal((:__bid_IDEC_glbround, libbid), Cuint) # rounding mode
Expand Down Expand Up @@ -226,7 +221,7 @@ for w in (32,64,128)
end
end

for c in (, :e, , :catalan, )
for c in (, :e, :, :γ, :catalan, )
@eval begin
Base.convert(::Type{$BID}, ::Irrational{$(QuoteNode(c))}) = $(_parse(T, setprecision(256) do
string(BigFloat(isdefined(Base, :MathConstants) ? eval(Base.MathConstants, c) : eval(c)))
Expand Down
13 changes: 12 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
using DecFP
using Base.Test

@static if VERSION < v"0.7.0-DEV.2005"
using Base.Test
else
using Test
end
if !(VERSION < v"0.7.0-DEV.3026")
using Printf
end
if !(VERSION < v"0.7.0-DEV.1592")
using Base.MathConstants
end

@test unsafe_load(DecFP.flags) == 0

Expand Down

0 comments on commit 2550bca

Please sign in to comment.