Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
CAN/CSA-ISO/IEC 10967-2-02 (also referred to as LIA-2) is the Canadian adoption of the international standard ISO/IEC 10967-2:2002, Language independent arithmetic – Part 2: Elementary numerical functions. It forms part of a three-part series that also includes LIA-1 (integer and floating-point arithmetic) and LIA-3 (complex arithmetic). LIA-2 provides precise specifications for the implementation of standard elementary functions — such as exponentials, logarithms, trigonometric and hyperbolic functions — to ensure portability, accuracy, and predictable exception handling across programming languages and hardware platforms.
By defining accuracy requirements in terms of units in the last place (ulps), specifying rounding behaviour, and mandating exception handling consistent with IEC 60559 (IEEE 754), LIA-2 plays a critical role in numerical software development. This article explores the standard’s scope, technical requirements, implementation challenges, and compliance considerations.
LIA-2 addresses the gap between language-independent arithmetic models and the concrete implementation of elementary numerical functions. Its primary goal is to enable developers to write portable numerical code by ensuring that the same function call — for example, sin(x) — returns results within well-defined error bounds on any conforming system, irrespective of the underlying hardware or operating system.
The standard applies to all floating-point radices and formats that conform to IEC 60559 (IEEE 754) and to the arithmetic specified in LIA-1. It covers the following categories of functions:
pow).The standard does not specify how these functions must be implemented, but it does set a bound on the maximum permissible error and requires that the implementation documents the achieved accuracy for each function.
LIA-2 defines accuracy using the concept of unit in the last place (ulp). For a given floating-point format and rounding mode, the maximum error (in ulps) between the computed result and the infinitely precise ideal result must not exceed a specified threshold. The thresholds vary by function and sometimes by interval within the function’s domain.
Table 1 shows representative accuracy requirements for a set of common elementary functions when computed in binary64 (double precision) with rounding to nearest, ties to even. The exact bounds given are illustrative of those accepted by typical conformance test suites; the standard itself may define different values depending on the implementationʼs declared accuracy profiles.
| Function | Max Error (ulps) | Special Remarks |
|---|---|---|
sqrt(x) | 0.5 | Correct rounding required; must be exact when feasible |
exp(x) | 1.0 | For all x in the normal range |
log(x) | 2.0 | Increasingly tighter bound near 1.0 |
sin(x) | 1.0 | After argument reduction; reduction must preserve accuracy |
cos(x) | 1.0 | Similarly relies on high-quality reduction |
pow(x, y) | 2.0 | Excluding special cases (exact powers) |
atan(x) | 1.0 | Uniform bound for entire positive domain |
sinh(x) | 2.0 | May degrade for very large arguments |
Implementations that achieve errors below 0.5 ulp are said to be correctly rounded; this is mandatory for a small set of operations (such as square root) but optional for others. The standard also allows the implementer to choose tight or relaxed error thresholds, as long as they are declared in the conformance documentation.
LIA-2 requires that all functions operate correctly under each of the five rounding modes specified by IEC 60559 (round to nearest ties to even, round toward zero, round toward +∞, round toward –∞, and round to nearest ties away from zero if supported). The behaviour of the functions with respect to floating-point exceptions — invalid operation, division by zero, overflow, underflow, and inexact — must follow the rules in IEC 60559. No spurious under- or overflow exceptions are allowed; every exception must be determined by the exact mathematical result and the used rounding mode.
Furthermore, the standard mandates monotonicity for all functions: if x ≤ y then for a non-decreasing function f(x) ≤ f(y) must hold in floating-point arithmetic, modulo underflow/overflow. This property is essential for the correctness of many numerical algorithms, such as root-finding and interpolation.
Implementing a high-quality mathematical library conforming to LIA-2 is a demanding task. The following aspects are critical:
sin and cos near x = 223 (for binary32) or 252 (for binary64). The so‑called “Payne‑Hanek” reduction is necessary to maintain even a 1 ulp error.Conformance to CAN/CSA-ISO/IEC 10967-2-02 is verified by testing the implementation against a suite of reference values that cover all required functions, all rounding modes, and all exception conditions. The standard defines a conformance report that documents:
The conformance test suite itself is not mandated by the standard, but several independent LIA‑2 test frameworks exist (e.g., the LIA‑2 test suite developed by INRIA or the IEEE P754‑based test harnesses). The Canadian adoption is identical to the international version; no additional national modifications have been introduced, so compliance with the original ISO/IEC 10967-2:2002 automatically satisfies the Canadian norm.
When evaluating a candidate library, it is advisable to run a stress test on extremes (subnormals, very large arguments, special values) and explicitly check that the error remains within the declared profile. Libraries that are not fully LIA‑2 compliant may still be usable, but they forfeit the portability guarantees that the standard provides.
This article was prepared for informational purposes and does not replace the official text of the standard. For certification and legal compliance, refer to the definitive version published by CSA Group.
Publication year: 2026