Mathematical way of determining whether a number is an integer I'm developing a computer program, and I've run into a mathematical problem. This isn't specific to any programming language, so it isn't really appropriate to ask on stackoverflow. Is there any way to determine whether a number is an integer using a mathematical function, from which a boolean response is given. 
For example:
let x equal 159
 let y equal 12.5
f(x) returns 1 and f(y) returns 0
Please get back to me if you can. If it isn't possible, is there a similar way to determine whether a number is odd or even?
EDIT:
I found a solution to the problem thats to Karolis Juodelė. I'll use a floor function to round the integer down, and then subtract the output from the original number. If the output is zero, then the function returns 0. 
I just need to make sure that floor is a purely mathematical function. Does anyone know?
Thanks

Since no one has answered with this debatable solution, I will post it. $$f(x) := \begin{cases}1 \qquad x \in \mathbb{Z}\\
0 \qquad x \in \mathbb{R} \setminus \mathbb{Z}\end{cases}$$ is a perfectly fine function. Even shorter would be $\chi_{\mathbb{Z}}$ defined on $\mathbb{R}$.
