Results 1 to 10 of 10

Math Help - How to calculate integer part from real number?

  1. #1
    Junior Member
    Joined
    Dec 2007
    Posts
    42

    How to calculate integer part from real number?

    This question could be trivial but I don't know the answer.

    Lets assume I have a real number, any real number.
    \forall x\in \mathbb{R}

    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 \mathbb{Z} part from any real number if exists?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Apr 2005
    Posts
    15,545
    Thanks
    1394
    Quote Originally Posted by tabularasa View Post
    This question could be trivial but I don't know the answer.

    Lets assume I have a real number, any real number.
    \forall x\in \mathbb{R}

    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 \mathbb{Z} part from any real number if exists?
    I don't understand your question. How is the number "given". That is, if you cannot "see the integer part directly" what can you see of the number?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Dec 2007
    Posts
    42
    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.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    o_O
    o_O is offline
    Primero Espada
    o_O's Avatar
    Joined
    Mar 2008
    From
    Canada
    Posts
    1,407
    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.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Junior Member
    Joined
    Dec 2007
    Posts
    42
    Quote Originally Posted by o_O View Post
    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.
    Of course we don't need a formula for that. Question is theoretical. But if you need, what the formula could be?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Member
    Joined
    Jan 2009
    Posts
    94
    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
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Junior Member
    Joined
    Dec 2007
    Posts
    42

    Smile

    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...
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor

    Joined
    Aug 2006
    Posts
    18,609
    Thanks
    1574
    Awards
    1
    Quote Originally Posted by tabularasa View Post
    This can be done with several algorithms. But I was looking mathematical formulation. So I'm looking mathematical way.
    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, \left( {\forall x \in \mathbb{R}} \right)\left( {\exists n \in \mathbb{Z}} \right)\left[ {n \leqslant x < n + 1} \right].
    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 x exists; but it does not begin to tell us how to find that integer.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    MHF Contributor

    Joined
    Apr 2005
    Posts
    15,545
    Thanks
    1394
    Quote Originally Posted by tabularasa View Post
    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.
    If you want a formula it is f(x)= floor(x).
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Newbie
    Joined
    Mar 2010
    Posts
    1

    Sawyer23

    If you still could not get your solution then you should go to other threads of this forum
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Calculate the area of a part of a function
    Posted in the Algebra Forum
    Replies: 2
    Last Post: March 12th 2011, 08:31 AM
  2. Replies: 3
    Last Post: February 8th 2011, 11:04 AM
  3. Replies: 2
    Last Post: August 19th 2010, 09:32 PM
  4. Replies: 17
    Last Post: June 14th 2009, 05:30 PM
  5. Replies: 1
    Last Post: February 13th 2009, 02:32 AM

Search Tags


/mathhelpforum @mathhelpforum