Table of Contents

CINT

Returns the value of the given floating-point value rounded to the nearest integer

Implemented by: level2, GWBASIC, bwbasic, bw32, ABasiC, QBasic, VBDOS, FreeBASIC, EndBASIC

With variations: altair12K (always converts to the lesser integer; overflows in values out of 16-bit range), MSX (rounds negatives down), Gambas

Also written as:

Usage

10 PRINT CINT(41.49)   ' shows "41"
20 PRINT CINT(41.51)   ' shows "42"

Variations

Microsoft BASICs which implement CINT usually limit its argument to the 16-bit signed range of -32768 to 32767. A lesser or greater input value causes an overflow error. CLNG allows for bigger numbers, in the 32-bit signed range.

The official documentation of Bywater BASIC 2.20 described CINT as "returns the truncated integer for the argument", which is equivalent to the FIX function that it did not implement; both keywords were implemented with their common behaviours in version 3.20.

Examples

Comments

Similar keywords

In other languages...

References