Difference between revisions of "Manuals/calci/ROUND"

From ZCubes Wiki
Jump to navigation Jump to search
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=ROUND(number, num_of_digits)=
+
<div style="font-size:30px">'''ROUND(Number,Decimals)'''</div><br/>
  
*Where 'number' is the number to round and  
+
*Where 'Number' is the number to round and  
*'num_of_digits' is the number of digits before or after decimal point.
+
*'Decimals' is the number of digits to which the number is to be rounded.
 +
**ROUND() rounds a number to specified number of digits.
  
ROUND() rounds the number to specified number of digits.
+
== Description ==
  
== Description ==
+
ROUND(Number,Decimals)
  
ROUND(number, num_of_digits)
+
This function is used to round a number to certain number of digits mentioned in the argument.
  
 
For Example,
 
For Example,
  
ROUND(3.6712,2) ''returns 3.67''
+
ROUND(3.6712,2) ''returns 3.67'' as a result.
 +
 
 +
ROUND(411.3,-1) ''returns 410'' as a result.
 +
 
 +
*If 'Decimals' is omitted, Calci assumes it to be zero and rounds the number to the nearest integer.
 +
*The number is rounded to the specified number of decimal places, if Decimals > 0.
 +
*The number is rounded to the nearest integer, if Decimals = 0.
 +
*The number is rounded to the left of the decimal point, if Decimals < 0.
 +
*If any argument is non-numeric, Calci displays #NaN error message.
 +
 
 +
ROUND() can also be used for multiple number array as -
  
*When Nd is greater than zero,the number is rounded to the specified number of decimal places.
+
ROUND(2.5..6..0.5) that rounds the numbers 2.5 to 6 in steps of 0.5.
*When  Nd is 0, the number is rounded to the nearest integer.
 
*When Nd  is less than 0, the number is rounded to the left of the decimal point.
 
  
 +
{| class="wikitable"
 +
|-
 +
! Number !! ROUND
 +
|-
 +
| 2.5 || 3
 +
|-
 +
| 3 || 3
 +
|-
 +
| 3.5 || 4
 +
|-
 +
| 4 || 4
 +
|-
 +
| 4.5 || 5
 +
|-
 +
| 5 || 5
 +
|-
 +
| 5.5 || 6
 +
|-
 +
| 6 || 6
 +
|-
 +
|}
  
 +
*ROUNDUP() can be used to round a number away from zero.
 +
*ROUNDDOWN() can be used to round a number towards zero.
 +
*MROUND() can be used to round a number to desired multiple.
  
 
== Examples ==
 
== Examples ==
Line 28: Line 61:
 
| class="  " | '''Function'''
 
| class="  " | '''Function'''
 
| class="  " | '''Output'''
 
| class="  " | '''Output'''
|
+
 
 
|- class="odd"
 
|- class="odd"
| class="sshl_f" | 3.6712
+
| class="sshl_f" | ROUND(3.6712,2)
| class="sshl_f" | 2
+
| class="sshl_f" | 3.67
|
+
 
 
|- class="even"
 
|- class="even"
| class="sshl_f" | 3.67
+
| class="sshl_f" | ROUND(99.37,0)
| class="sshl_f" |
+
| class="sshl_f" | 99
|
+
 
 
|- class="odd"
 
|- class="odd"
| class="sshl_f" |
+
| class="sshl_f" | ROUND(99.37)
| class="sshl_f" |
+
| class="sshl_f" | 99
|
+
 
 
|- class="even"
 
|- class="even"
| class="sshl_f" |
+
| class="sshl_f" | ROUND(145.8,-1)
| class="sshl_f" |
+
| class="sshl_f" | 150
|
+
 
 
|- class="odd"
 
|- class="odd"
| class="sshl_f" |
+
| class="sshl_f" | ROUND(-89.65,1)
| class="sshl_f" |
+
| class="sshl_f" | -89.7
|
+
 
 +
|- class="even"
 +
| class="sshl_f" | ROUND(-89.65,-1)
 +
| class="sshl_f" | -90
 
|}
 
|}
 +
 +
==Related Videos==
 +
 +
{{#ev:youtube|_MIn3zFkEcc|280|center|ROUNDING DECIMALS}}
 +
 +
== See Also ==
 +
 +
*[[Manuals/calci/MROUND | MROUND]]
 +
 +
*[[Manuals/calci/ROUNDDOWN | ROUNDDOWN]]
 +
 +
*[[Manuals/calci/ROUNDUP | ROUNDUP]]
 +
 +
*[[Manuals/calci/INT | INT]]
 +
 +
*[[Manuals/calci/TRUNC | TRUNC]]
 +
 +
*[[Manuals/calci/CEILING | CEILING]]
 +
 +
*[[Manuals/calci/FLOOR | FLOOR]]
 +
 +
==References==
 +
 +
*[http://en.wikipedia.org/wiki/Rounding Round Function]
 +
 +
 +
 +
*[[Z_API_Functions | List of Main Z Functions]]
 +
 +
*[[ Z3 |  Z3 home ]]

Latest revision as of 15:33, 21 August 2018

ROUND(Number,Decimals)


  • Where 'Number' is the number to round and
  • 'Decimals' is the number of digits to which the number is to be rounded.
    • ROUND() rounds a number to specified number of digits.

Description

ROUND(Number,Decimals)

This function is used to round a number to certain number of digits mentioned in the argument.

For Example,

ROUND(3.6712,2) returns 3.67 as a result.

ROUND(411.3,-1) returns 410 as a result.

  • If 'Decimals' is omitted, Calci assumes it to be zero and rounds the number to the nearest integer.
  • The number is rounded to the specified number of decimal places, if Decimals > 0.
  • The number is rounded to the nearest integer, if Decimals = 0.
  • The number is rounded to the left of the decimal point, if Decimals < 0.
  • If any argument is non-numeric, Calci displays #NaN error message.

ROUND() can also be used for multiple number array as -

ROUND(2.5..6..0.5) that rounds the numbers 2.5 to 6 in steps of 0.5.

Number ROUND
2.5 3
3 3
3.5 4
4 4
4.5 5
5 5
5.5 6
6 6
  • ROUNDUP() can be used to round a number away from zero.
  • ROUNDDOWN() can be used to round a number towards zero.
  • MROUND() can be used to round a number to desired multiple.

Examples

Function Output
ROUND(3.6712,2) 3.67
ROUND(99.37,0) 99
ROUND(99.37) 99
ROUND(145.8,-1) 150
ROUND(-89.65,1) -89.7
ROUND(-89.65,-1) -90

Related Videos

ROUNDING DECIMALS

See Also

References