"For developers", "Server scripts", "Functions descriptions", "Mathematical", "Frac".

 

Getting the fractional part of an integer with a floating point after comma.

 

Syntax

function Frac(x: extended): integer;

 

Parameters and return values

Parameter

Type

Value

x

extended

a real integer from which you need to compute the fractional part.

 

Function result

Fractional part of an integer.

 

Example

var
  x: extended;
begin
  x := 10/3.0;
  mLogScript(IntToStr(Trunc(x)), 'integer part:');
  mLogScript(FloatToStr(Frac(x)), 'fractional part:');
end.

Script work result

[14:34:24] (Log "

[14:34:24] (Log "Frac"): [fractional part:] 0.333333333333

[14:34:24] (Run "Frac"): Script operation time: 4 ms

[14:34:24] (Run "Frac"): Script done successfully.
 

See also

IntToStr

FloatToStr
mLogScript