Jump to content

Rounding: Difference between revisions

From LabVIEW Wiki
Removed external links from section titles and moved them to the external links section where they belongs.
Line 4: Line 4:
The following functions are available:<br />
The following functions are available:<br />


==[http://zone.ni.com/reference/en-XX/help/371361D-01/glang/round_to_nearest/  Round to nearest]==
==Round to nearest==
[[Image:Roundfun.png]]<br />
[[Image:Roundfun.png]]<br />
This routine rounds the (floating point) input to the nearest integer. It follows IEEE854 standards for rounding the number. The IEEE standard states that if a number is exactly in between two integers (y.5<s>0</s>) the output will be the nearest integer with an even least significant bit. This means that the number will be rounded to the nearest even integer.
This routine rounds the (floating point) input to the nearest integer. It follows IEEE854 standards for rounding the number. The IEEE standard states that if a number is exactly in between two integers (y.5<s>0</s>) the output will be the nearest integer with an even least significant bit. This means that the number will be rounded to the nearest even integer.
This approach is known under various names (banker's rounding, roundTiesToEven) and removes rounding errors in large statistical data-sets.
This approach is known under various names (banker's rounding, roundTiesToEven) and removes rounding errors in large statistical data-sets.


==[http://zone.ni.com/reference/en-XX/help/371361D-01/glang/round_to_posinfinity/  Round up]==
==Round up==
[[Image:Roundup.png]]<br />
[[Image:Roundup.png]]<br />
This routine rounds the (floating point) input to the next bigger integer. It follows IEEE754 standards for 'Round towards' + <math>\infty</math>.
This routine rounds the (floating point) input to the next bigger integer. It follows IEEE754 standards for 'Round towards' + <math>\infty</math>.


==[http://zone.ni.com/reference/en-XX/help/371361D-01/glang/round_to_neginfinity/  Round down]==
==Round down==
[[Image:Rounddn.png]]<br />
[[Image:Rounddn.png]]<br />
This routine rounds the (floating point) input to the next smaller integer. It follows IEEE754 standards for 'Round towards' - <math>Infinity</math>'.
This routine rounds the (floating point) input to the next smaller integer. It follows IEEE754 standards for 'Round towards' - <math>Infinity</math>'.
Line 22: Line 22:
* [http://grouper.ieee.org/groups/754/ IEEE pagon on standard 754]
* [http://grouper.ieee.org/groups/754/ IEEE pagon on standard 754]
* [http://standards.ieee.org/reading/ieee/std_public/description/busarch/854-1987_desc.html outline of standard 854]
* [http://standards.ieee.org/reading/ieee/std_public/description/busarch/854-1987_desc.html outline of standard 854]
*[http://zone.ni.com/reference/en-XX/help/371361D-01/glang/round_to_nearest/ LabVIEW 8.5 manual: Round to Nearest]
*[http://zone.ni.com/reference/en-XX/help/371361D-01/glang/round_to_posinfinity/ LabVIEW 8.5 manual: Round Toward +Infinity]
*[http://zone.ni.com/reference/en-XX/help/371361D-01/glang/round_to_neginfinity/ LabVIEW 8.5 manual: Round Toward -Infinity]


[[Category:Numeric]]
[[Category:Numeric]]

Revision as of 03:57, 27 August 2008

LabVIEW has several rounding routines. They are part of the numeric palette.

The following functions are available:

Round to nearest


This routine rounds the (floating point) input to the nearest integer. It follows IEEE854 standards for rounding the number. The IEEE standard states that if a number is exactly in between two integers (y.50) the output will be the nearest integer with an even least significant bit. This means that the number will be rounded to the nearest even integer. This approach is known under various names (banker's rounding, roundTiesToEven) and removes rounding errors in large statistical data-sets.

Round up


This routine rounds the (floating point) input to the next bigger integer. It follows IEEE754 standards for 'Round towards' + <math>\infty</math>.

Round down


This routine rounds the (floating point) input to the next smaller integer. It follows IEEE754 standards for 'Round towards' - <math>Infinity</math>'.

External links