@@ -39,9 +39,13 @@ macro xchk(x, exc, args...)
3939 end
4040 quote
4141 ret = $ (esc (x))
42- f = unsafe_load (flags[])
43- unsafe_store! (flags[], 0 )
44- f & $ mask != 0 && throw ($ exc ($ (map (esc,args)... )))
42+ if $ exc === nothing
43+ unsafe_store! (flags[], 0 )
44+ else
45+ f = unsafe_load (flags[])
46+ unsafe_store! (flags[], 0 )
47+ f & $ mask != 0 && throw ($ exc ($ (map (esc,args)... )))
48+ end
4549 ret
4650 end
4751end
@@ -213,7 +217,7 @@ for w in (32,64,128)
213217 if isnan (x) && ! isnanstr (s)
214218 throw (ArgumentError (" invalid number format $s " ))
215219 end
216- return @xchk (x, InexactError, :parse , $ BID, s )
220+ return @xchk (x, nothing )
217221 end
218222
219223 $ BID (x:: AbstractString ) = parse ($ BID, x)
@@ -422,7 +426,7 @@ for w in (32,64,128)
422426 @eval promote_rule (:: Type{$BID} , :: Type{$BID′} ) = $ BID
423427 end
424428 if w != w′
425- @eval Base. convert (:: Type{$BID} , x:: $BID′ ) = @xchk (ccall (($ (string (" __bid" ,w′," _to_" ," bid" ,w)), libbid), $ BID, ($ BID′,), x), InexactError, :convert , $ BID, x, mask = INEXACT )
429+ @eval Base. convert (:: Type{$BID} , x:: $BID′ ) = @xchk (ccall (($ (string (" __bid" ,w′," _to_" ," bid" ,w)), libbid), $ BID, ($ BID′,), x), nothing )
426430 end
427431
428432 # promote binary*decimal -> decimal, for consistency with other operations above
0 commit comments