@@ -105,6 +105,8 @@ for w in (32,64,128)
105105end
106106
107107# quickly check whether s begins with "±nan"
108+ @static if VERSION < v " 0.7.0-DEV.5126"
109+
108110function isnanstr (s:: AbstractString )
109111 i = start (s)
110112 while ! done (s, i)
@@ -124,6 +126,44 @@ function isnanstr(s::AbstractString)
124126 return true
125127end
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