Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you heard of ? 😉

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