|
This function is used to round a numeric value to a defined accuracy. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Syntax: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{INT_VAR|FLO_VAR}= rnd({NUM_EXPR}) or |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I/O parameters: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Return value: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Declaration of Variables | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Result: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In this example the constant 23,2641758 was rounded to three digits behind the decimal point. If another number than the defaulted 1 to 3 digits is entered for the digits behind the decimal point, an error message is displayed. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
In this example, the six-digit display is caused by using the command 'put'. In order to prevent errors, the float/double type must be used if results can be expected to be either very large or very small (<2^-31 or > 2^31). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
Functions and commands: Mathematics |