Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileINT(x) TRUNC(x) FIX(x) FRAC(x) x: aexp These functions allow independent manipulation of the parts of a numerical expression to the left and right of the decimal point: INT(), TRUNC(), and FIX() (TRUNC() and FIX() are identical) return a whole number. The function TRUNC() simply cuts off the digits to the right of the decimal point. INT() returns the largest whole number which is less than or equal to x. There is no difference between TRUNC() (or FIX()) and INT() for positive x-values, however, with a negative, non-integer x a difference arises. So TRUNC(-1.2) removes the decimal places and returns -1 as the result. INT(-1.2), on the other hand, returns the next smaller whole number, namely -2. FRAC() returns only the fractional part of x, in other words just the decimal places, with the same sign as x had. FRAC() is complementary to TRUNC() and not to INT(). It is always true that x=TRUNC(x)+FRAC(x), but INT(x)+FRAC(x) is not equal to x for negative values. Example: x=-1.4 y=TRUNC(1.3) PRINT y,INT(x),FIX(3*x),FRAC(x-3) --> The numbers 1, -2, -4 and -0.4 are displayed.