Home

Fract

Fract, short for fractional part, is a mathematical concept used to describe the non-integer portion of a real number. In many programming and mathematical contexts, fract(x) denotes the fractional part of x, separating it from its integer part. It is distinct from the broader idea of a fraction and from fractals, which are geometric shapes.

The standard mathematical definition of fract(x) is x minus the floor of x. That is fract(x) = x

There are alternative conventions used in some contexts. Some definitions use x minus the truncation of x,

In computing, fract can be implemented via various methods, such as fmod(x, 1.0) or by computing x

Applications of fract appear in numeric algorithms, computer graphics, signal processing, and anywhere a value must

−
floor(x).
The
floor
function
returns
the
greatest
integer
less
than
or
equal
to
x.
With
this
convention,
fract(x)
lies
in
the
interval
[0,
1).
For
example,
fract(3.75)
=
0.75
and
fract(−2.7)
=
0.3.
The
function
is
periodic
with
period
1,
since
fract(x
+
1)
=
fract(x).
where
trunc(x)
removes
the
fractional
part
toward
zero.
In
that
case
fract(−2.7)
would
be
−0.7.
Because
of
these
variations,
the
term
fractional
part
can
refer
to
slightly
different
concepts
depending
on
the
convention
in
use.
−
floor(x).
Some
languages
also
provide
dedicated
functions
(for
example,
modf
in
C)
that
return
both
the
integer
and
fractional
parts
separately.
The
choice
of
convention
affects
the
sign
and
interpretation
of
the
result.
be
scaled
to
a
unit
interval
or
repeated
cyclically.
See
also
fractional
part,
modulo,
floor
function,
and
truncation.