trunc Function (ROM Call 0xBC)

timath.h

long trunc (float x);

Converts floating point to integer.

trunc truncates floating point argument x to the long integer result. Returns zero in a case of overflow. This routine performs the same operation as casting a floating point value to an int type using '(int)', '(unsigned int)' and '(long)' typecast operators, but it is kept here to allow compatibility with older programs created before TIGCC introduced floating point operators (i.e. before release 0.9 of TIGCC). This function is automatically called when any function which needs an integer is called with a floating point arguments, to force a truncation of a floating point value to an integer. Also, you can do assignments like b = a; when a is a floating point variable (or expression) and b is an integer variable. In both cases, trunc will be called automatically to perform the truncation. At the fundamental level, trunc is exactly the same routine as bcdlong.


Uses: ST_modKey, _bcd_math
Used by: bcdlong