MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8883] Re: [Help?] Integer/Decimal portion of a real number
  • From: murray at math.umass.edu (Murray Eisenberg)
  • Date: Tue, 30 Sep 1997 20:16:51 -0400
  • Organization: University of Massachusetts, Amherst
  • Sender: owner-wri-mathgroup at wolfram.com

kammy shan leung (ksleung at students.uiuc.edu) wrote:

: ...  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?

    IntegerPart[4.12345]
4
    FractionalPart[4.12345]
0.12345

The function IntegerPart may or may not be what you want in case your
number is negative.  See The Mathematica Book, 3rd Edition, Section
3.3.2 (or on-line material in Help Browser).

--
  Murray Eisenberg                       Internet:  murray at math.umass.edu
  Mathematics & Statistics Dept.            Voice:  413-545-2859 (W)
  University of Massachusetts                       413-549-1020 (H)
  Amherst, MA 01003                           Fax:  413-545-1801


  • Prev by Date: Shaded Symbols in MultipleListPlot
  • Next by Date: Re: Turning the elements of a list into the arguments of a function.
  • Previous by thread: Re: [Help?] Integer/Decimal portion of a real number
  • Next by thread: Re: Turning the elements of a list into the arguments of a function.