@@ -105,6 +105,8 @@ for w in (32,64,128)
105
105
end
106
106
107
107
# quickly check whether s begins with "±nan"
108
+ @static if VERSION < v " 0.7.0-DEV.5126"
109
+
108
110
function isnanstr (s:: AbstractString )
109
111
i = start (s)
110
112
while ! done (s, i)
@@ -124,6 +126,44 @@ function isnanstr(s::AbstractString)
124
126
return true
125
127
end
126
128
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
+
127
167
"""
128
168
exponent10(x::DecFP.DecimalFloatingPoint)
129
169
@@ -360,7 +400,7 @@ for w in (32,64,128)
360
400
for c in (:π , :e , :ℯ , :γ , :catalan , :φ )
361
401
@eval begin
362
402
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)))
364
404
end ))
365
405
end
366
406
end
0 commit comments