1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 07:41:21 +00:00
qb64/internal/help/CINT.txt

36 lines
1.1 KiB
Plaintext
Raw Normal View History

2017-10-10 14:55:21 +00:00
The [[CINT]] function rounds decimal point numbers up or down to the nearest [[INTEGER]] value.
2016-03-18 11:36:04 +00:00
{{PageSyntax}}
2017-10-10 14:55:21 +00:00
: {{Parameter|value%}} = [[CINT]]({{Parameter|expression}})
2016-03-18 11:36:04 +00:00
2021-02-18 17:11:22 +00:00
{{PageParameters}}
2017-10-10 14:55:21 +00:00
* {{Parameter|expression}} is any [[TYPE]] of literal or variable numerical value or mathematical calculation.
2016-03-18 11:36:04 +00:00
{{PageDescription}}
2017-10-10 14:55:21 +00:00
* 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.
2016-03-18 11:36:04 +00:00
2017-10-10 14:55:21 +00:00
{{PageExamples}}
2019-04-15 01:15:33 +00:00
''Example:'' Shows how CINT rounds values up or down as in "bankers' rounding".
2016-03-18 11:36:04 +00:00
{{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}}
2017-10-10 14:55:21 +00:00
* [[_ROUND]], [[_CEIL]]
* [[CLNG]], [[CSNG]], [[CDBL]]
* [[INT]], [[FIX]]
2016-03-18 11:36:04 +00:00
2019-04-15 01:15:33 +00:00
{{PageNavigation}}