Skip to content

Commit 628c4cb

Browse files
authored
Merge pull request #72 from stevengj/jq/0.7
0.7 compat
2 parents 74645ce + 60d971f commit 628c4cb

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
deps/IntelRDFPMathLib*
44
deps/installed_vers
55
deps/libbid*.*
6+
deps/deps.jl
7+
deps/usr

src/DecFP.jl

+41-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ for w in (32,64,128)
105105
end
106106

107107
# quickly check whether s begins with "±nan"
108+
@static if VERSION < v"0.7.0-DEV.5126"
109+
108110
function isnanstr(s::AbstractString)
109111
i = start(s)
110112
while !done(s, i)
@@ -124,6 +126,44 @@ function isnanstr(s::AbstractString)
124126
return true
125127
end
126128

129+
else
130+
131+
function isnanstr(s::AbstractString)
132+
st = iterate(s)
133+
c, i = '\0', 0
134+
while st !== nothing
135+
c, i = st
136+
isspace(c) || break
137+
st = iterate(s, i)
138+
end
139+
st === nothing && return false
140+
if c == '+' || c == '-'
141+
st = iterate(s, i)
142+
st === nothing && return false
143+
c, i = st
144+
end
145+
(c == 'n' || c == 'N') || return false
146+
st = iterate(s, i)
147+
if st !== nothing
148+
c, i = st
149+
if c == 'a' || c == 'A'
150+
st = iterate(s, i)
151+
if st !== nothing
152+
c, i = st
153+
if c == 'n' || c == 'N'
154+
st = iterate(s, i)
155+
if st === nothing
156+
return true
157+
end
158+
end
159+
end
160+
end
161+
end
162+
return false
163+
end
164+
165+
end
166+
127167
"""
128168
exponent10(x::DecFP.DecimalFloatingPoint)
129169
@@ -360,7 +400,7 @@ for w in (32,64,128)
360400
for c in (, :e, :ℯ, , :catalan, )
361401
@eval begin
362402
Base.convert(::Type{$BID}, ::Irrational{$(QuoteNode(c))}) = $(_parse(T, setprecision(256) do
363-
string(BigFloat(isdefined(Base, :MathConstants) ? eval(Base.MathConstants, c) : eval(c)))
403+
string(BigFloat(isdefined(Base, :MathConstants) ? Core.eval(Base.MathConstants, c) : eval(c)))
364404
end))
365405
end
366406
end

0 commit comments

Comments
 (0)