SIListra Safety Math Library

Verified, pre-encoded math functions for floating-point safety algorithms: trigonometry, square root, power, exponential and logarithm for both channels of the SIListra Safety Transformer.

  • Trigonometry, square root, power, exp/log
  • Exact or < 1 ulp precision (atan2: < 2 ulp)
  • float and double
  • Safety manual and test suite
TÜV SÜD-certified Pre-encoded float and double

Mathematically Sophisticated Safety Algorithms

Robotics, motion control, autonomous mobile robots, automated guided vehicles and sensor fusion depend on floating-point arithmetic. Since version 3.0.0, the SIListra Safety Transformer supports floating-point arithmetic for Coded Processing, based on our SafeFloat research project. But these algorithms also need mathematical functions such as trigonometry and square roots – e.g. sin, tan, acos and sqrt – for calculations in two- and three-dimensional space.

The C and C++ standard libraries provide these functions, but they cannot be used with the SIListra Safety Transformer: the Transformer encodes every function your safety code calls and therefore needs its source code, which is often not available for a standard library; in addition, the standard libraries are typically not certified for safety-related applications. Instead of implementing and verifying these functions yourself, you can use the SIListra Safety Math Library (SML): high-performance, verified and accurate implementations of the most commonly required math functions.

TÜV SÜD-Certified With the SIListra Safety Transformer 3.0.0

The SIListra Safety Math Library is covered by the same TÜV SÜD certificate as the SIListra Safety Transformer 3.0.0, for the same standards: IEC 61508, ISO 26262, ISO 13849, IEC 62061 and IEC 61511.

Certificate Z10 123504 0001 · TÜV SÜD certificate database ↗ (opens in a new tab)

Certificate details

Pre-Encoded, Not Transformed

The SML contains a native and an encoded, runtime-optimized implementation of every function. Its source code is not passed through the SIListra Safety Transformer: it is compiled and linked together with the encoded channel. The pre-encoded implementations provide the diagnostics required by Coded Processing with less runtime overhead than transforming the math functions as part of your application. The SML comes with a test suite, and running it on your target platform is required to confirm its correct behavior there.

1. Native Channel
Your source code includes the SML header
➔
2. SIListra Safety Transformer
Generates the encoded channel, reading only the SML header
➔
3. SML Modules
Pre-encoded functions, compiled directly
➔
4. Your Compiler & Linker
Builds both channels together with the SML
➔
5. Safety App
Safe math in both channels

The Most Commonly Used Math Functions

All functions behave exactly as defined in the C and C++ standards and support double and float. Results that cannot be represented exactly in binary floating-point format have a documented maximum error in ulps (“unit in the last place”, the spacing between adjacent representable values) – in most situations a relative precision of about 1.2·10−7 for float and 2.2·10−16 for double.

Basic Operations

fabs, fmax, fmin, fmod, remainder

Precision: exact

Classification

isfinite, isinf, isnan, isnormal, issubnormal, iszero, signbit

Precision: exact

Nearest Integer

ceil, floor, roundeven

Precision: exact

Exponential Functions

exp, log

Precision: < 1 ulp

Power Functions

sqrt, pow

Precision: < 1 ulp

Trigonometric Functions

sin, cos, tan, asin, acos, atan, atan2

Precision: < 1 ulp (atan2: < 2 ulp)

Details

What the SML Provides

  • Native and pre-encoded implementation of every function
  • Support for double and float; specialized float implementations for fabs, fmod, remainder, all classification functions and sqrt
  • All floating-point constants of the POSIX standard, e.g. e, π, π/2, ln(2) and sqrt(2)
  • API under the SIL_SML_ prefix to avoid naming conflicts, plus a compatibility header for selected C standard-library names
  • Safety manual and test suite – running the test suite on your target platform is required to confirm correct behavior there
  • TÜV SÜD-certified together with the SIListra Safety Transformer (certificate details)
Example

Rotating a Point in 2D

#include <SML/SIListra_math.h>

typedef struct {
    double x;
    double y;
} Point2D;

/* Rotates p around the origin by angle_rad
   radians, counter-clockwise if positive. */
Point2D rotate_point(Point2D p, double angle_rad) {
    const double c = SIL_SML_cos(angle_rad);
    const double s = SIL_SML_sin(angle_rad);

    return (Point2D){
        p.x * c - p.y * s,
        p.x * s + p.y * c
    };
}

Floating-Point Math in Your Safety Application?

Talk to us about the SIListra Safety Math Library and how it fits your algorithms – non-binding and confidential.

Start Evaluation
Follow us on: