xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Int()

Converts a numeric value to an integer.

Syntax

Int( <nNumber> ) --> nInteger

Arguments

<nNumber>
A numeric value to convert to an integer.

Return

The function returns an integer numeric value.

Description

The function Int() truncates decimal fractions of a numeric value and returns the numeric integer value.

Info

See also:Abs(), Round()
Category: Numeric functions
Source:rtl\round.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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 )

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe