| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Converts a numeric value to an integer.
Int( <nNumber> ) --> nInteger
The function returns an integer numeric value.
The function Int() truncates decimal fractions of a numeric value and returns the numeric integer value.
| See also: | Abs(), Round() |
| Category: | Numeric functions |
| Source: | rtl\round.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows a user defined function which tests if a number
// is an integer.
PROCEDURE Main
? IsInteger( 2 ) // result: .T.
? IsInteger( SQrt(2) ) // result: .F.
RETURN
FUNCTION IsInteger( nNumber )
RETURN ( nNumber - Int(nNumber) == 0 )
http://www.xHarbour.com