Re: [Help?] Integer/Decimal portion of a real number

• To: mathgroup at smc.vnet.net
• Subject: [mg8863] Re: [mg8847] [Help?] Integer/Decimal portion of a real number
• From: David Withoff <withoff>
• Date: Tue, 30 Sep 1997 20:16:27 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```> Hi,
>
> I'm fairly new with mathematica, and I have a simple question that I
> can't figure out.  What I would like to do is break up a real number to
> its integer and decimal portion.
>
>  For example:
>
>   4.12345 can be broken up to:
>
>  integer_portion = 4
>  decimal_portion = 12345
>
>  Is there a simple function that will provide me with these values?
>
> would appreciate if you would email me.
>
> Thanks,
> Kammy Leung
> --
> ksleung at uiuc.edu

You can get the integer part of a number using IntegerPart, and
the fractional part of a number using FractionalPart:

In[11]:= IntegerPart[4.12345]

Out[11]= 4

In[12]:= FractionalPart[4.12345]

Out[12]= 0.12345

If you want to get the integer 12345 rather than the fractional
part 0.12345, that can be done fairly easily too, but the solution
will depend on the details of what you want to do, such as the
number of digits to compute.

Dave Withoff
Wolfram Research

```

• Prev by Date: RE: How to select a cell in Mathematica?
• Next by Date: RE: Font Problem with Mathematica v3.0
• Previous by thread: Re: [Help?] Integer/Decimal portion of a real number
• Next by thread: Re: [Help?] Integer/Decimal portion of a real number