Difference between revisions of "Manuals/calci/MROUND"

From ZCubes Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=MROUND(number, multiple)=
+
<div style="font-size:30px">'''MROUND (Number,Multiple)'''</div><br/>
 
+
*Where 'Number' is the number to round and  
*Where 'number' is the number to round and  
+
*'Multiple' is the multiple value to which number is to be rounded.
*'multiple' is the multiple value to which number is to be rounded.
+
**MROUND() returns a number rounded to the desired multiple
 
 
MROUND() rounds a number to specified multiple.
 
  
 
== Description ==
 
== Description ==
  
MROUND(number, multiple)
+
MROUND(Number, Multiple)
  
This function is used to round a number to desired multiple.
+
This function is used to round a number up or down depending on the multiple value.
  
 
For Example,
 
For Example,
Line 19: Line 17:
  
 
*The number is rounded up or down, depending on the remainder of division of the number and the multiple. If the remainder is more than or equal to half the multiple value, the number is rounded up, else it is rounded down towards zero.
 
*The number is rounded up or down, depending on the remainder of division of the number and the multiple. If the remainder is more than or equal to half the multiple value, the number is rounded up, else it is rounded down towards zero.
 
+
*Calci returns an NaN error message if any argument is nonnumeric or omitted.  
*If 'num_of_digits' is omitted, Calci assumes it to be zero and rounds the number to the nearest integer.
+
*Calci returns an #ERROR message if 'number' and 'multiple' have different signs.
*The number is rounded to the specified number of decimal places, if num_of_digits > 0.
+
*If the number is an exact multiple, rounding will not be done. Calci will display the same number as output.
*The number is rounded to the nearest integer, if num_of_digits = 0.
 
*The number is rounded to the left of the decimal point, if num_of_digits < 0.
 
*If any argument is non-numeric, Calci displays #NaN error message.
 
  
 
MROUND() can also be used for multiple number array as -
 
MROUND() can also be used for multiple number array as -
  
MROUND(2.5..6..0.5) that rounds the numbers 2.5 to 6 in steps of 0.5.
+
MROUND(2.5..7.5, 2) that rounds the numbers from 2.5 to 7.5 to nearest multiple of 2.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Number !! MROUND
+
! Number !! Multiple !! MROUND
|-
 
| 2.5 || 3
 
|-
 
| 3 || 3
 
 
|-
 
|-
| 3.5 || 4
+
| 2.5 || 2 || 2
 
|-
 
|-
| 4 || 4
+
| 3.5 || 2 || 4
 
|-
 
|-
| 4.5 || 5
+
| 4.5 || 2 || 4
 
|-
 
|-
| 5 || 5
+
| 5.5 || 2 || 6
 
|-
 
|-
| 5.5 || 6
+
| 6.5 || 2 || 6
 
|-
 
|-
| 6 || 6
+
| 7.5 || 2 || 8
 
|-
 
|-
 
|}
 
|}
  
 +
*ROUND() can be used to round a number to specified number of digits.
 
*ROUNDUP() can be used to round a number away from zero.
 
*ROUNDUP() can be used to round a number away from zero.
 
*ROUNDDOWN() can be used to round a number towards 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 66: Line 57:
  
 
|- class="odd"
 
|- class="odd"
| class="sshl_f" | MROUND(3.6712,2)
+
| class="sshl_f" | MROUND(3.67,2)
| class="sshl_f" | 3.67
+
| class="sshl_f" | 4
  
 
|- class="even"
 
|- class="even"
| class="sshl_f" | MROUND(99.37,0)
+
| class="sshl_f" | MROUND(99,3)
 
| class="sshl_f" | 99
 
| class="sshl_f" | 99
  
 
|- class="odd"
 
|- class="odd"
| class="sshl_f" | MROUND(99.37)
+
| class="sshl_f" | MROUND(4.35,0.01)
| class="sshl_f" | 99
+
| class="sshl_f" | 4.35
  
 
|- class="even"
 
|- class="even"
| class="sshl_f" | MROUND(145.8,-1)
+
| class="sshl_f" | MROUND(-89.65,-3)
| class="sshl_f" | 150
+
| class="sshl_f" | -90
 +
|}
  
|- class="odd"
+
==Related Videos==
| class="sshl_f" | MROUND(-89.65,1)
 
| class="sshl_f" | -89.7
 
  
|- class="even"
+
{{#ev:youtube|dyMgvQLTzVE|280|center|MROUND}}
| class="sshl_f" | MROUND(-89.65,-1)
 
| class="sshl_f" | -90
 
|}
 
  
 
== See Also ==
 
== See Also ==
Line 109: Line 96:
  
 
*[http://en.wikipedia.org/wiki/Rounding Round Function]
 
*[http://en.wikipedia.org/wiki/Rounding Round Function]
 +
 +
 +
 +
*[[Z_API_Functions | List of Main Z Functions]]
 +
 +
*[[ Z3 |  Z3 home ]]

Latest revision as of 14:56, 21 August 2018

MROUND (Number,Multiple)


  • Where 'Number' is the number to round and
  • 'Multiple' is the multiple value to which number is to be rounded.
    • MROUND() returns a number rounded to the desired multiple

Description

MROUND(Number, Multiple)

This function is used to round a number up or down depending on the multiple value.

For Example,

MROUND(3.6, 2) returns 4 as a result.

MROUND(44.1, 4) returns 44 as a result.

  • The number is rounded up or down, depending on the remainder of division of the number and the multiple. If the remainder is more than or equal to half the multiple value, the number is rounded up, else it is rounded down towards zero.
  • Calci returns an NaN error message if any argument is nonnumeric or omitted.
  • Calci returns an #ERROR message if 'number' and 'multiple' have different signs.
  • If the number is an exact multiple, rounding will not be done. Calci will display the same number as output.

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

MROUND(2.5..7.5, 2) that rounds the numbers from 2.5 to 7.5 to nearest multiple of 2.

Number Multiple MROUND
2.5 2 2
3.5 2 4
4.5 2 4
5.5 2 6
6.5 2 6
7.5 2 8
  • ROUND() can be used to round a number to specified number of digits.
  • ROUNDUP() can be used to round a number away from zero.
  • ROUNDDOWN() can be used to round a number towards zero.

Examples

Function Output
MROUND(3.67,2) 4
MROUND(99,3) 99
MROUND(4.35,0.01) 4.35
MROUND(-89.65,-3) -90

Related Videos

MROUND

See Also

References