---
url: >-
  /statelake/scripting-reference/functions-and-procedures/numeric-functions/frac.md
---

# Frac

**Frac** returns the fractional portion of a decimal number, specified by the parameter of **X**.

The function accepts minus signs but not separating commas or any other non-numeric character as input.

::: info
Be aware that as **Frac** returns a **floating-point** number, the result may not be exactly what you expect.
:::

Also refer to the **Int** function [Int](/statelake/scripting-reference/functions-and-procedures/numeric-functions/int) to return the floating-point integer part of a decimal number.

**Declaration**: function Frac(const X: Extended): Extended

Examples of the use and result of this function are below.

```pascal
Procedure OnMapEvent(var Value:variant);
begin
  Value :=  Frac(5674.89001);      // returns 0.890010000000075
  Value :=  Frac(5674.33);         // returns 0.329999999999927
  Value :=  Frac(867.1233);        // returns 0.123299999999972
  Value :=  Frac(-2867.5588);      // returns -0.558799999999792
end;
```
