Returns the fractional part of a value.
fPart(value)
Press:
- MATH to access the math menu.
- RIGHT to access the NUM submenu.
- 4 to select fPart(, or use arrows.
TI-83/84/+/SE/CE
1 byte
fPart(value) returns the fractional part of value, be it a variable, list, or matrix.
fPart(5.32)
.32
fPart(4/5)
.8
fPart(‾5.32)
‾.32
fPart(‾4/5)
‾.8
Advanced Uses
fPart(, along with int( or iPart(, can be used for integer compression.
Also, fPart( is an easy way to find A mod B (the positive remainder when A is divided by B).
:B(A<0)+iPart(BfPart(A/B))
If A is guaranteed to be positive, the following shorter code can be used, omitting B(A<0):
:iPart(BfPart(A/B))
Finally, the easiest way to check if a number is a whole number is not(fPart(X:
:If not(fPart(X:Then
: // X is an integer
:Else
: // X is not an integer
:End
This can be used, for example, to check if a number is divisible by another: if X is divisible by N, then X/N is a whole number. This is useful for finding the factors of a number. Warning: when storing values with repeating decimals and later multiplying them to see if a number makes it an integer it can return a value of 1 or -1 instead of 0 even if it is an integer do rounding errors. Example: storing 1/3 to X and computingfPart(3X) will return 1 instead of 0. This is because fPart(.999…) results in .999… and then rounds to 1 when displaying rather than rounding to 1.0 and then displaying the fPart( as 0.
Related Commands
See Also
.