This question could be trivial but I don't know the answer.
Lets assume I have a real number, any real number.
for example 1220,74 = 1220.
Of course we can see the integer part directly or we can use calculator or computer. But how to calculate without calculator/computer the part from any real number if exists?
I'm looking mathematical solution how integer part can be resolved from real number. It is intuitive clear to know the integer part since we see whole real number but if I have to calculate the integer part, how we can technically do that in math? So how we can resolve integer part of any real number?
For example real number's 1200,756 integer number is 1200, how to technically calculate this? Rounding is not mandatory.
What do you mean by 'mathematical solution' and 'calculate'? Isn't it just enough to truncate the digits following the decimal place? No calculations are necessary.
If you gave me the number 1200.756, I don't need a formula to tell me that 1200 is the integer I'm looking for.
This is funny but I think I have an idea.
The following pseudo-code will give you what you want:
X is the real number.
Find number of digits before decimal (this is doable by a simple loop)
Let number of digits be N.
do while (N>=1)
{i=0
do while (X >= 10^N)
{X= X - 10^N
i++
}
firstDigit = i
X = X - firstDigit * 10^N
N = N-1
}
intResult=firstDigit *10^N + secondDigit *10^(N-1) + ... + lastDigit
END
OR simply you can write
=int(X)
in Excel and get the result.
This is really funny... I enjoyed it !!!
-O
hehee :-) . Very nice loop. This can be done with several algorithms. But I was looking mathematical formulation. Or could you formulate your loop. At very first there is a problem how to calculate N, number of digits, ok that can be done calculating logarithm from the number, not easy to continue with that. Let's go to back.
So I'm looking mathematical way. You have only your quill, rag paper and candlelight...
You seem to have a somewhat different view of mathematics.
As the others have told you this is not something that can calculated mathematically.
Now it is a standard theorem that,
Put another way: Every real nuber is an integer or is between an integer and its successor.
But that is only an existence theorem, it tells us that the integer part of exists; but it does not begin to tell us how to find that integer.