Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

Table of Contents

Search

  1. Preface
  2. Understanding Data Types and Field Properties
  3. Designing Processes
  4. Using and Displaying Data
  5. Designing Guides
  6. Designing Process Objects
  7. Designing Service Connectors
  8. Using App Connections
  9. System Services, Listeners and Connectors
  10. Designing Human Tasks

Design

Design

round-half-to-even

round-half-to-even

The value returned is the numerically closest value to
$arg
that is a multiple of ten to the power of minus
$precision
. If two such values are equally near, for example, if the fractional part in
$arg
is exactly .500..., the function returns the one whose least significant digit is even.

Syntax

fn:round-half-to-even(arg, precision)
The following table describes the argument for this command:
Argument
Required/Optional
Description
arg
Required
The number to round.
precision
Required
The precision to round the number to. It can be a positive or negative integer.

Return Value

  • Numeric value.
  • The returned value is rounded to the number of decimal places indicated by
    $precision
    . For example, if the precision specified is 2, the function rounds 594.3271 to 594.33. If the precision is 0, the number is rounded to an integer. Specifying a negative precision results in the number being rounded to the left of the decimal point. For example, if
    $precision
    is -2, the function rounds 594.3271 to 600. If
    $precision
    is omitted, it defaults to 0.
  • If the argument is exactly half way between two values, it is rounded to whichever adjacent value is even.
  • The result type depends the numeric type of the argument. If
    $arg
    is untyped, it is cast to
    xs:double
    .

Examples

The following table lists some sample values and return values:
SAMPLE FUNCTION
OUTPUT
fn:round-half-to-even(5.5)
6
fn:round-half-to-even(6.5)
6
fn:round-half-to-even(9372.253, 2)
9372.25
fn:round-half-to-even(9372.253, 0)
9372
fn:round-half-to-even(9372.253, -3)
9000

0 COMMENTS

We’d like to hear from you!