CEIL: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "{{DISPLAYTITLE:_CEIL}} The _CEIL function rounds a numeric value up to the next whole number or INTEGER value. {{PageSyntax}} : {{Parameter|result}} = _CEIL({{Parameter|expression}}) * _CEIL returns he smallest integral value that is greater than the numerical {{Parameter|expression}} (as a floating-point value). * This means that _CEIL rounds up for both positive and negative numbers. ==Availability== * '''Version 1.000 and up.''' {{PageExam...") |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:_CEIL}} | {{DISPLAYTITLE:_CEIL}} | ||
The [[_CEIL]] function rounds a numeric value up to the next whole number or [[INTEGER]] value. | The [[_CEIL]] function rounds a numeric value up to the next whole number or [[INTEGER]] value. | ||
Line 11: | Line 11: | ||
{{PageAvailability}} | |||
* ''' | * '''QB64 v1.0 and up''' | ||
* '''QB64-PE all versions''' | |||
Line 18: | Line 19: | ||
''Example:'' Displaying the rounding behavior of [[INT]], [[CINT]] and [[FIX]] vs [[_CEIL]]. | ''Example:'' Displaying the rounding behavior of [[INT]], [[CINT]] and [[FIX]] vs [[_CEIL]]. | ||
{{CodeStart}} | {{CodeStart}} | ||
PRINT INT(2.5), CINT(2.5), FIX(2.5), _CEIL(2.5) | {{Cl|PRINT}} {{Cl|INT}}({{Text|2.5|#F580B1}}), {{Cl|CINT}}({{Text|2.5|#F580B1}}), {{Cl|FIX}}({{Text|2.5|#F580B1}}), {{Cl|_CEIL}}({{Text|2.5|#F580B1}}) | ||
PRINT INT(-2.5), CINT(-2.5), FIX(-2.5), _CEIL(-2.5) | {{Cl|PRINT}} {{Cl|INT}}({{Text|-2.5|#F580B1}}), {{Cl|CINT}}({{Text|-2.5|#F580B1}}), {{Cl|FIX}}({{Text|-2.5|#F580B1}}), {{Cl|_CEIL}}({{Text|-2.5|#F580B1}}) | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{OutputStart}} 2 2 2 3 | {{OutputStart}} 2 2 2 3 | ||
Line 28: | Line 29: | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[INT]], [[FIX]] | * [[INT]], [[FIX]] | ||
* [[CINT]], [[CLNG]], | * [[CINT]], [[CLNG]], | ||
* [[CSNG]], [[CDBL]] | * [[CSNG]], [[CDBL]] | ||
* [[_ROUND]] | * [[_ROUND]] |
Latest revision as of 11:28, 20 March 2023
The _CEIL function rounds a numeric value up to the next whole number or INTEGER value.
Syntax
- result = _CEIL(expression)
- _CEIL returns he smallest integral value that is greater than the numerical expression (as a floating-point value).
- This means that _CEIL rounds up for both positive and negative numbers.
Availability
- QB64 v1.0 and up
- QB64-PE all versions
Examples
Example: Displaying the rounding behavior of INT, CINT and FIX vs _CEIL.
PRINT INT(2.5), CINT(2.5), FIX(2.5), _CEIL(2.5) PRINT INT(-2.5), CINT(-2.5), FIX(-2.5), _CEIL(-2.5) |
2 2 2 3 -3 -2 -2 -2 |
See also