CAN/CSA-ISO/IEC 10967-2-02: A Technical Guide to Elementary Numerical Functions in Language Independent Arithmetic

Specifying Accuracy and Portability for Standard Elementary Functions in Numerical Computing

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.

Scope and Overview

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:

  • Basic algebraic functions: absolute value, square root, cube root, reciprocal, and exponentiation by powers (pow).
  • Transcendental functions: exponential and logarithmic functions (base e, base 10, base 2).
  • Trigonometric and inverse trigonometric functions: sine, cosine, tangent, arcus functions.
  • Hyperbolic and inverse hyperbolic functions.
  • Rounding and conversion functions: truncation, rounding, integer conversion, scaling, and reduction functions for angles.
  • Prefix and suffix functions: functions used to compute the next representable floating-point number, predecessor, successor, etc.

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.

Technical Requirements

Accuracy Constraints in Ulps

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.

Table 1: Typical Maximum Error Bounds for Elementary Functions (binary64, default rounding)
FunctionMax Error (ulps)Special Remarks
sqrt(x)0.5Correct rounding required; must be exact when feasible
exp(x)1.0For all x in the normal range
log(x)2.0Increasingly tighter bound near 1.0
sin(x)1.0After argument reduction; reduction must preserve accuracy
cos(x)1.0Similarly relies on high-quality reduction
pow(x, y)2.0Excluding special cases (exact powers)
atan(x)1.0Uniform bound for entire positive domain
sinh(x)2.0May 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.

Rounding Modes and Exception Handling

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 xy 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.

Implementation Considerations

Implementing a high-quality mathematical library conforming to LIA-2 is a demanding task. The following aspects are critical:

Success: With proper use of polynomial approximations, range reduction, and careful management of rounding modes, modern software libraries can meet the LIA‑2 accuracy targets for nearly all elementary functions.
  • Argument reduction: For trigonometric functions, reducing the argument to a small interval (e.g., [–π/4, π/4]) must be done with extra precision to avoid catastrophic cancellation. Some implementations use double‑double or triple‑double arithmetic.
  • Polynomial and rational approximations: Carefully minimax polynomial approximations (e.g., Chebyshev, Remez) are typical. The coefficients are stored and evaluated in the working precision, often with guard digits.
  • Correct rounding: For functions that require correct rounding, a two-step approach is common: compute a preliminary result, determine the distance to the next representable number using extra precision, and if necessary, adjust the rounding. The so‑called “invariance to the rounding mode” must be maintained.
  • Fused multiply-add (FMA): Hardware FMA instructions can greatly improve accuracy for polynomial evaluation and for constructing error compensation mechanisms.
Tip: Always use the FMA instruction when available for the evaluation of polynomials. It reduces latency and simplifies error analysis because the fused operation counts as one rounding.
Warning: Be extremely cautious when implementing argument reduction for 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.

Compliance and Conformance Notes

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 maximum observed error (in ulps) for each function and rounding mode,
  • the set of floating-point formats supported,
  • the rounding direction for each format,
  • the behaviour near zeros, infinities, and NaNs,
  • the monotonicity verification, and
  • the results of exception handling tests (occurrence and propagation).

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.

Danger: Failing to maintain monotonicity is one of the most common reasons for non‑conformance. Even a small region where the computed result decreases when the input increases (for a non‑decreasing function) is a violation.

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.

Frequently Asked Questions

Q: How does LIA-2 relate to the IEEE 754 standard for floating-point arithmetic?
A: LIA-2 builds on the formats and rounding modes defined by IEEE 754 (IEC 60559). It specifies how the elementary functions must behave within that arithmetic framework, thereby adding a layer of functional specification beyond the basic arithmetic operations covered by IEEE 754.
Q: Is LIA-2 mandatory for programming languages like C, C++, or Fortran?
A: No, but many compilers and runtime libraries voluntarily comply because it simplifies cross-platform validation. For example, the IEEE 754 binary floating-point implementations in ISO C (Annex F) strongly encourage conformance to LIA-2 for the standard math functions.
Q: Does CAN/CSA-ISO/IEC 10967-2-02 differ from the original ISO/IEC 10967-2:2002?
A: The Canadian adoption is identical in technical content. The only differences are minor editorial changes to reflect Canadian metrological and legal requirements. Therefore, a software library that conforms to the international standard automatically conforms to the Canadian version.
Q: Where can I obtain a copy of the standard?
A: The standard is available from the Standards Council of Canada (SCC) or directly from ISO/IEC. Many university libraries also provide access through online standards portals. The document number is CAN/CSA-ISO/IEC 10967-2-02.


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

📥 Standard Documents Download

🔒
Please wait 10 seconds, the download links will appear after the ad loads

Leave a Reply

Your email address will not be published. Required fields are marked *