# How to match -1 at arbitrary precision?

Suppose a want a pattern to match:

-1
-1.
-1.42 (or any other value for the precision)


with a pattern. What would be the best pattern to use? I guess one could use

_?(N@#==-1.&)


but this seems like it shouldn't be the best approach. Any thoughts?

• I don't think there are significantly better ways to do it, tbh. Is there any reason why you're not satisfied with this pattern? It depends on the application, I guess. If you want to find -1 values in an array, there are vectorised ways to do it. – Sjoerd Smit Jul 18 '18 at 12:52
• Cases[{-1, -1., -1. 42}, _?(# == -1 &)]  works for me – Bob Hanlon Jul 18 '18 at 17:59
• _?(PossibleZeroQ[#+1]&) perhaps. – Daniel Lichtblau Jul 18 '18 at 18:17