gives the fractional part of x.
- 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.
Examplesopen allclose all
Basic Examples (3)
Numerical Evaluation (5)
The precision of the output tracks the precision of the input:
Evaluate efficiently at high precision:
FractionalPart threads elementwise over lists:
Specific Values (6)
Values of FractionalPart at fixed points:
Value at Infinity:
Manipulate FractionalPart symbolically:
Find a value of x for which the FractionalPart[x]=0.5:
Plot the FractionalPart function:
Plot scaled FractionalPart functions:
Plot FractionalPart in three dimensions:
Visualize FractionalPart in the complex plane:
Function Properties (11)
FractionalPart is defined for all real and complex inputs:
Function range of FractionalPart:
FractionalPart is an odd function:
FractionalPart can be made periodic on the reals by adding one to its value on the negative reals:
FractionalPart is not an analytic function:
It has both singularities and discontinuities:
FractionalPart is neither nondecreasing nor nonincreasing:
FractionalPart is not injective:
FractionalPart is not surjective:
FractionalPart is neither non-negative nor non-positive:
FractionalPart is neither convex nor concave:
Find the first few digits of , using Stirling's approximation:
Plot fractional parts of powers:
Plot fractional parts of powers of a Pisot number:
Iterate the shift map with a rational initial condition and plot the result:
See the degradation in precision for approximate real numbers:
Properties & Relations (3)
Convert FractionalPart to Piecewise:
Denest FractionalPart functions:
Possible Issues (2)
Guard digits influence the result of FractionalPart:
Numerical decision procedures with default settings cannot simplify this expression:
Using a larger setting for $MaxExtraPrecision gives the expected result:
Neat Examples (1)
Convergence of the Fourier series of FractionalPart:
Wolfram Research (1996), FractionalPart, Wolfram Language function, 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.
Wolfram Language. (1996). FractionalPart. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FractionalPart.html