mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-07 09:30:15 +00:00
39 lines
1.1 KiB
Text
39 lines
1.1 KiB
Text
|
{{QBDLDATE:05-20-2022}}
|
||
|
{{QBDLTIME:23:12:13}}
|
||
|
The [[CINT]] function rounds decimal point numbers up or down to the nearest [[INTEGER]] value.
|
||
|
|
||
|
|
||
|
{{PageSyntax}}
|
||
|
: {{Parameter|value%}} = [[CINT]]({{Parameter|expression}})
|
||
|
|
||
|
|
||
|
{{Parameters}}
|
||
|
* {{Parameter|expression}} is any [[TYPE]] of literal or variable numerical value or mathematical calculation.
|
||
|
|
||
|
|
||
|
{{PageDescription}}
|
||
|
* Values greater than .5 are rounded up. Values lower than .5 are rounded down.
|
||
|
* ''Warning:'' Since [[CINT]] is used for integer values, the input values cannot exceed 32767 to -32768!
|
||
|
* Use [[CLNG]] for [[LONG]] integer values exceeding [[INTEGER]] limitations.
|
||
|
* Note: When decimal point values are given to BASIC functions requiring [[INTEGER]]s the value will be [[CINT]]ed.
|
||
|
|
||
|
|
||
|
{{PageExamples}}
|
||
|
''Example:'' Shows how CINT rounds values up or down as in "bankers' rounding".
|
||
|
{{CodeStart}}
|
||
|
a% = {{Cl|CINT}}(1.49): b% = {{Cl|CINT}}(1.50): c = 11.5
|
||
|
{{Cl|COLOR}} c: {{Cl|PRINT}} a%, b%, c
|
||
|
{{CodeEnd}}
|
||
|
{{OutputStart}}{{text|1 2 11.5|red}}
|
||
|
{{OutputEnd}}
|
||
|
|
||
|
|
||
|
{{PageSeeAlso}}
|
||
|
* [[_ROUND]], [[_CEIL]]
|
||
|
* [[CLNG]], [[CSNG]], [[CDBL]]
|
||
|
* [[INT]], [[FIX]]
|
||
|
|
||
|
|
||
|
{{PageNavigation}}
|
||
|
|