Is it a whole number?
Haskell, 27 16 bytes
This function checks whether x
is contained in the list of nonnegative integers that are not greater than x
.
f x=elem x[0..x]
Try it online!
APL (Dyalog), 3 bytes
⌊≡|
Try it online!
Note that f←
has been prepended in the TIO link due to technical limitations, but it's not normally needed.
Wolfram Language (Mathematica), 17 15 14 bytes
Saved 1 byte thanks to Not a tree!
#>=0==#~Mod~1&
Try it online!
First Mathematica answer \o/
Mathematica, 15 bytes
Saved 2 bytes thanks to @user202729!
#==⌊Abs@#⌋&