Skip to content

FractionalPart ​

The fractional part of x, with the sign of x: x minus its integer part.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageFractionalPart✓
FractionalPart(x)x minus IntegerPart(x), with the sign of x.
Typed signatures
TypePackageApplies
(number) -> numberanalyticalways

Domain: Elementary functions

Details
  • Keeps the sign of x, unlike compute-engine's native Fract, which always lands in [0,1)[0, 1): FractionalPart(−7/2)=−1/2\mathrm{FractionalPart}(-7/2) = -1/2, where Fract(−7/2)=1/2\mathrm{Fract}(-7/2) = 1/2.
  • Exact where IntegerPart is: an exact rational reduces to an exact rational, and a symbolic constant like Pi stays exact and symbolic (FractionalPart(π)=π−3\mathrm{FractionalPart}(\pi) = \pi - 3).
  • Zero exactly on the integers.
  • Real domain -- a concretely complex argument is left unevaluated.

Examples

Basic #
live ↗
InFractionalPart(2.5)\mathrm{FractionalPart}(2.5)Out0.50.5
live ↗
InFractionalPart(72)\mathrm{FractionalPart}(\frac{7}{2})Out12\frac{1}{2}

Keeps the sign of x, unlike compute-engine's Fract

live ↗
InFractionalPart(−72)\mathrm{FractionalPart}(-\frac{7}{2})Out−12-\frac{1}{2}
Scope #

Exact numeric arguments stay exact

live ↗
InFractionalPart(π)\mathrm{FractionalPart}(π)Outπ−3π-3

Threads element-wise over a list

live ↗
InFractionalPart([72,−13])\mathrm{FractionalPart}(\bigl\lbrack\frac{7}{2}, -\frac{1}{3}\bigr\rbrack)Out[12,−13]\bigl\lbrack\frac{1}{2}, -\frac{1}{3}\bigr\rbrack
Properties #

Zero exactly on the integers

live ↗
InFractionalPart(5)\mathrm{FractionalPart}(5)Out00
About
Examples6
Checked againstWolfram Language 6 agree
CrosswalkWolfram Language