A point outside a domain can test inside at machine precision either (1) from round-off error or (2) because machine-precisions comparisons are done with tolerance.
The points Plot3D
plugs into the function depend on the y
range. Change it and I would expect different spikes, if the first paragraph explains the behavior.
I don't have a definitive fix. I base mine on the function being plotted. I might use WorkingPrecision
, Internal`$EqualTolerance
, SetPrecision
, RegionFunction
, Exclusions
, "ExtrapolationHandler"
in interpolating functions, and maybe other things. I probably can't add much more specificity without a specific function to address.