WOLFRAM

gives the fractional part of x.

Details

  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • FractionalPart[x] in effect takes all digits to the right of the decimal point and drops the others.
  • FractionalPart[x]+IntegerPart[x] is always exactly x.
  • FractionalPart[x] yields a result when x is any numeric quantity, whether or not it is an explicit number.
  • For exact numeric quantities, FractionalPart internally uses numerical approximations to establish its result. This process can be affected by the setting of the global variable $MaxExtraPrecision.
  • FractionalPart applies separately to real and imaginary parts of complex numbers.
  • FractionalPart automatically threads over lists. »

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Find the fractional part of a real number:

Out[1]=1

Find the fractional part of a negative real number:

Out[1]=1

Plot over a subset of the reals:

Out[1]=1

Scope  (31)Survey of the scope of standard use cases

Numerical Evaluation  (6)

Evaluate numerically:

Out[1]=1
Out[5]=5
Out[7]=7

Complex number inputs:

Out[1]=1

Evaluate to high precision:

Out[1]=1

The precision of the output tracks the precision of the input:

Out[2]=2

Evaluate efficiently at high precision:

Out[1]=1
Out[2]=2

Compute the elementwise values of an array using automatic threading:

Out[1]=1

Or compute the matrix FractionalPart function using MatrixFunction:

Out[2]=2

Compute average-case statistical intervals using Around:

Out[1]=1

Specific Values  (6)

Values of FractionalPart at fixed points:

Out[2]=2

Value at zero:

Out[1]=1

Value at Infinity:

Out[1]=1

Evaluate symbolically:

Out[1]=1

Manipulate FractionalPart symbolically:

Out[1]=1
Out[2]=2

Find a value of x for which the FractionalPart[x]=0.5:

Out[1]=1
Out[2]=2

Visualization  (4)

Plot the FractionalPart function:

Out[1]=1

Plot scaled FractionalPart functions:

Out[1]=1

Plot FractionalPart in three dimensions:

Out[1]=1

Visualize FractionalPart in the complex plane:

Out[1]=1

Function Properties  (11)

FractionalPart is defined for all real and complex inputs:

Out[1]=1
Out[2]=2

Function range of FractionalPart:

Out[1]=1

FractionalPart is an odd function:

Out[1]=1

FractionalPart can be made periodic on the reals by adding one to its value on the negative reals:

Out[1]=1

FractionalPart is not an analytic function:

Out[1]=1

It has both singularities and discontinuities:

Out[2]=2
Out[3]=3

FractionalPart is neither nondecreasing nor nonincreasing:

Out[1]=1

FractionalPart is not injective:

Out[1]=1
Out[2]=2

FractionalPart is not surjective:

Out[1]=1
Out[2]=2

FractionalPart is neither non-negative nor non-positive:

Out[1]=1

FractionalPart is neither convex nor concave:

Out[1]=1

TraditionalForm formatting:

Differentiation and Integration  (4)

First derivative with respect to x:

Out[1]=1

Second derivative with respect to x:

Out[1]=1

Evaluate an integral:

Out[1]=1

Series expansion:

Out[1]=1

Applications  (7)Sample problems that can be solved with this function

Find the first few digits of , using Stirling's approximation:

Out[1]=1

Plot fractional parts of powers:

Out[1]=1
Out[2]=2

Plot fractional parts of powers of a Pisot number:

Out[1]=1

Iterate the shift map with a rational initial condition and plot the result:

Out[1]=1
Out[2]=2

Irrational initial condition:

Out[3]=3

See the degradation in precision for approximate real numbers:

Out[4]=4
Out[1]=1
Out[1]=1

Make a Bernoulli polynomial periodic and plot it:

Out[1]=1

Properties & Relations  (3)Properties of the function, and connections to other functions

Out[1]=1

Convert FractionalPart to Piecewise:

Out[1]=1

Denest FractionalPart functions:

Out[1]=1

Possible Issues  (2)Common pitfalls and unexpected behavior

Guard digits influence the result of FractionalPart:

Out[1]=1
Out[2]=2
Out[3]=3

Numerical decision procedures with default settings cannot simplify this expression:

Out[1]=1

Using a larger setting for $MaxExtraPrecision gives the expected result:

Out[2]=2

Neat Examples  (1)Surprising or curious use cases

Convergence of the Fourier series of FractionalPart:

Out[1]=1
Wolfram Research (1996), FractionalPart, Wolfram Language function, https://reference.wolfram.com/language/ref/FractionalPart.html.
Wolfram Research (1996), FractionalPart, Wolfram Language function, https://reference.wolfram.com/language/ref/FractionalPart.html.

Text

Wolfram Research (1996), FractionalPart, Wolfram Language function, https://reference.wolfram.com/language/ref/FractionalPart.html.

Wolfram Research (1996), FractionalPart, Wolfram Language function, https://reference.wolfram.com/language/ref/FractionalPart.html.

CMS

Wolfram Language. 1996. "FractionalPart." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FractionalPart.html.

Wolfram Language. 1996. "FractionalPart." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FractionalPart.html.

APA

Wolfram Language. (1996). FractionalPart. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FractionalPart.html

Wolfram Language. (1996). FractionalPart. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FractionalPart.html

BibTeX

@misc{reference.wolfram_2025_fractionalpart, author="Wolfram Research", title="{FractionalPart}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/FractionalPart.html}", note=[Accessed: 05-June-2025 ]}

@misc{reference.wolfram_2025_fractionalpart, author="Wolfram Research", title="{FractionalPart}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/FractionalPart.html}", note=[Accessed: 05-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_fractionalpart, organization={Wolfram Research}, title={FractionalPart}, year={1996}, url={https://reference.wolfram.com/language/ref/FractionalPart.html}, note=[Accessed: 05-June-2025 ]}

@online{reference.wolfram_2025_fractionalpart, organization={Wolfram Research}, title={FractionalPart}, year={1996}, url={https://reference.wolfram.com/language/ref/FractionalPart.html}, note=[Accessed: 05-June-2025 ]}