gives the fractional part of x.
FractionalPart
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 all close allBasic Examples (3)
Scope (31)
Numerical Evaluation (6)
FractionalPart[5.45533]FractionalPart[-5 / 4]FractionalPart[Pi + E]//NFractionalPart[235 / 47 + 5.3 I]N[FractionalPart[4568 / 4456], 50]The precision of the output tracks the precision of the input:
FractionalPart[0.3127888888555555555520003000]Evaluate efficiently at high precision:
FractionalPart[7545 / 4660`10000];//TimingN[FractionalPart[(E + Pi) ^ 2 - E ^ 2 - Pi ^ 2 - 2 E Pi], 10^5]//Quiet//TimingCompute the elementwise values of an array using automatic threading:
FractionalPart[{{1 / 2, -1}, {5 / 3, 1 / 2}}]Or compute the matrix FractionalPart function using MatrixFunction:
MatrixFunction[FractionalPart, {{1 / 2, -1}, {5 / 3, 1 / 2}}]//FullSimplifyCompute average-case statistical intervals using Around:
FractionalPart[ Around[1 / 2, 0.01]]Specific Values (6)
Values of FractionalPart at fixed points:
Table[FractionalPart[n ], {n, {1 / 7, 5 / 4, 7 / 3, 7 / 2}}]FractionalPart[0]Value at Infinity:
FractionalPart[Infinity]PiecewiseExpand[FractionalPart[x], 0 < x < 4]Manipulate FractionalPart symbolically:
FullSimplify[FractionalPart[x] + FractionalPart[x + 1 / 2], 0 < x < 1 / 3]Reduce[FractionalPart[x] + FractionalPart[2x - 1] == 0 && 0 < x < 4, x, Reals]Find a value of x for which the FractionalPart[x]=0.5:
xval = x /. FindRoot[FractionalPart[x] == 0.5, {x, 1}]Plot[FractionalPart[x], {x, -2, 3}, Epilog -> Style[Point[{xval, FractionalPart[xval]}], PointSize[Large], Red], ExclusionsStyle -> Dotted]Visualization (4)
Plot the FractionalPart function:
Plot[FractionalPart[x], {x, -3, 3}, Filling -> Axis]Plot scaled FractionalPart functions:
Plot[{FractionalPart[x], FractionalPart[x / 2], FractionalPart[2x]}, {x, -4, 4}, PlotLegends -> "Expressions", PlotTheme -> "DashedLines"]Plot FractionalPart in three dimensions:
Plot3D[FractionalPart[x + y], {x, -3, 3}, {y, -3, 3}, ColorFunction -> "BlueGreenYellow"]Visualize FractionalPart in the complex plane:
ComplexPlot[FractionalPart[z], {z, 3}, IconizedObject[«ComplexPlot options»]]Function Properties (11)
FractionalPart is defined for all real and complex inputs:
FunctionDomain[FractionalPart[x], x]FunctionDomain[FractionalPart[x], x, Complexes]Function range of FractionalPart:
FunctionRange[FractionalPart[x], x, y]//QuietFractionalPart is an odd function:
FractionalPart[-x] == -FractionalPart[x]FractionalPart can be made periodic on the reals by adding one to its value on the negative reals:
FunctionPeriod[Piecewise[{{FractionalPart[x], x >= 0}, {1 + FractionalPart[x], x < 0}}], x]FractionalPart is not an analytic function:
FunctionAnalytic[FractionalPart[x], x]It has both singularities and discontinuities:
FunctionSingularities[FractionalPart[x], x]FunctionDiscontinuities[FractionalPart[x], x]FractionalPart is neither nondecreasing nor nonincreasing:
FunctionMonotonicity[FractionalPart[x], x]FractionalPart is not injective:
FunctionInjective[FractionalPart[x], x]Plot[{FractionalPart[x], .5}, {x, -5, 5}]FractionalPart is not surjective:
FunctionSurjective[FractionalPart[x], x]Plot[{FractionalPart[x], -2}, {x, -5, 5}]FractionalPart is neither non-negative nor non-positive:
FunctionSign[FractionalPart[x], x]FractionalPart is neither convex nor concave:
FunctionConvexity[FractionalPart[x], x]TraditionalForm formatting:
FractionalPart[x]//TraditionalFormDifferentiation and Integration (4)
First derivative with respect to x:
D[FractionalPart[x], x]Second derivative with respect to x:
D[FractionalPart[x], {x, 2}]Integrate[FractionalPart[x ^ 2], {x, 0, 3}]Series[FractionalPart[x ^ 2], {x, 1, 2}, Assumptions -> Element[x, Reals]]Applications (7)
Find the first few digits of
, using Stirling's approximation:
Block[{$MaxExtraPrecision = Infinity}, 10 ^ N[FractionalPart[LogGamma[10 ^ 100 + 1] / Log[10]], 10]]Plot fractional parts of powers:
ListPlot[Table[FractionalPart[(3 / 2) ^ n], {n, 100}]]ListPlot[Table[N[FractionalPart[GoldenRatio ^ n], 20], {n, 100}]]Plot fractional parts of powers of a Pisot number:
ListPlot[Table[FractionalPart[Root[-1 - #1 + #1 ^ 3&, 1] ^ n], {n, 100}]]Iterate the shift map with a rational initial condition and plot the result:
NestList[FractionalPart[2#]&, 1 / 11, 10]ListPlot[%]NestList[FractionalPart[2#]&, Pi / 4, 10]//ExpandSee the degradation in precision for approximate real numbers:
NestList[FractionalPart[2#]&, N[Pi / 4, 8], 30]Plot the fractional part of a quadratic function:
Plot[FractionalPart[x + x ^ 2], {x, -3, 3}]Visualize the fractional part of a complex argument:
Plot3D[Abs[FractionalPart[x + I y]], {x, -3, 3}, {y, -3, 3}]Make a Bernoulli polynomial periodic and plot it:
Plot[BernoulliB[12, FractionalPart[x]], {x, 0, 12}]Properties & Relations (3)
Plot the FractionalPart function:
Plot[FractionalPart[x], {x, -3, 3}]Convert FractionalPart to Piecewise:
PiecewiseExpand[FractionalPart[x ^ 2], 0 < x < 2]Denest FractionalPart functions:
PiecewiseExpand[FractionalPart[x + 1 / 3 + FractionalPart[1 - x / 2] ^ 3], x∈Reals && -1 < x < 1]Possible Issues (2)
Guard digits influence the result of FractionalPart:
FractionalPart[1`100 - 10 ^ -110]FractionalPart[1`100 + 10 ^ -110]1`100 - 10 ^ -110 === 1`100 + 10 ^ -110Numerical decision procedures with default settings cannot simplify this expression:
FractionalPart[1 + Exp[-Exp[E] ^ 2]]Using a larger setting for $MaxExtraPrecision gives the expected result:
Block[{$MaxExtraPrecision = 100}, FractionalPart[1 + Exp[-Exp[E] ^ 2]]]Neat Examples (1)
Convergence of the Fourier series of FractionalPart:
Plot[Evaluate[Table[1 / 2 - Sum[Sin[2Pi k x] / k, {k, 1, n}] / Pi, {n, 10}]],
{x, 0, 4}]Tech Notes
Related Guides
Related Links
History
Introduced in 1996 (3.0)
Text
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.
APA
Wolfram Language. (1996). FractionalPart. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FractionalPart.html
BibTeX
@misc{reference.wolfram_2026_fractionalpart, author="Wolfram Research", title="{FractionalPart}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/FractionalPart.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_fractionalpart, organization={Wolfram Research}, title={FractionalPart}, year={1996}, url={https://reference.wolfram.com/language/ref/FractionalPart.html}, note=[Accessed: 12-June-2026]}