Instant properties: fract

The instant property fract represents the fractional part of a float operand.

Declaration

float float.fract

Discussion

The instant property fract returns the fractional part of the operand in context of which the property is evaluated by removing the integer digits. Please note, the instant property trunc is read-only. The write access to this property is not allowed. For example:

var float f1 = 11.3; var float f2 = -5.3; var float f3 = -7.7; var float result1 = f1.fract; // result1 = 0.3 var float result2 = f2.fract; // result2 = -0.3 var float result3 = f3.fract; // result3 = -0.7 // Write access is not allowed f1.fract = 0.1; // Chora Compiler error

See also the built-in function math_fract() as well as the cognate instant properties floor, round, ceil and trunc.