I want to extract the integer part of number.
For example, I have the number 2.754 and the expected result would be 2.
Can i do it in a mathematical way?
I want to extract the integer part of number.
For example, I have the number 2.754 and the expected result would be 2.
Can i do it in a mathematical way?
In a mathematical way is a pretty vague term.
Consider the tangent function $\tan(x)$ and the usual branch of its inverse, $\arctan(x)$, from $\mathbb R$ to $(-\pi/2,\pi/2)$.
Then with appropriate scalings and shiftings
$$f(x)=\frac1\pi\arctan\left(\tan\left(\pi\left(x+\frac12\right)\right)\right)+\frac12$$
is a sawtooth signal of period $1$, i.e. the fractional part of $x$.
Then $x-f(x)$ is the integer part.
This definition doesn't work for integers though :(
Yes, this is the floor function, $f(x)=\lfloor x\rfloor$. For a real number $a$, the integer part of $a$ is denoted $\lfloor a\rfloor$ (i.e. the floor of $a$).
Edit: Note that this notation is given as \lfloor x \rfloor, where \lfloor is the left side of the floor (i.e. \lfloor=$\lfloor$) and \rfloor is the right side of the floor (i.e. \rfloor=$\rfloor$).