Functions

frac

Supported By

Syntax

[the] frac of factor

frac ( expression )

Factor and expression yield integers, numbers, or complexes.

Example

put frac(steve) into bill

Description

The frac function returns the fractional part of the given value, discarding the integer part, regardless of sign. The sign of the result will be the same as the sign of the given value.

The following table illustrates the behavior of the frac function:

argument result
2 0
1.75 0.75
1.5 0.5
1.25 0.25
1 0
0.75 0.75
0.5 0.5
0.25 0.25
0 0
-0.25 -0.25
-0.5 -0.5
-0.75 -0.75
-1 0
-1.25 -0.25
-1.5 -0.5
-1.75 -0.75
-2 0

If the given value is a complex, the real and imaginary parts of the complex number are each processed individually.

See Also

int