1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 11:40:38 +00:00
QB64-PE/internal/help/CINT.txt
SteveMcNeill 33adc04fc4 Add temp folder to repo. It's necessary as well!
Just more initial setting on... nothing much to see here.
2022-04-28 13:39:56 -04:00

37 lines
1.1 KiB
Plaintext

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}}
<