MATHLIB User's Manual (c66x)


Page Contents

  1. Introduction to MATHLIB
  2. Getting Started
  3. MATHLIB Usage Examples
  4. Integration
  5. MISRA Compliance

Introduction to MATHLIB

The Texas Instruments MATHLIB library is an optimized floating-point math function library for C programmers using TI floating point devices. These routines are typically used in computationally intensive real-time applications where optimal execution speed is critical. By using these routines instead of the routines found in the existing run-time-support libraries, you can achieve execution speeds considerably faster without rewriting existing code. The MATHLIB library includes all floating-point math routines currently provided in existing run-time-support libraries. These new functions can be called with the current run-time-support library names or the new names included in the MATHLIB library.

Features and Benefits

The TI c66x MATHLIB contains commonly used floating point math routines, as well as source code that allows you to modify functions to match your specific needs.

Software Routines

The rich set of software routines included in MATHLIB are organized into two categories:

  1. Single precision floating point
  2. Double precision floating point

For detailed descriptions of each MATHLIB function see the MATHLIB Function Reference.

Getting Started

Unless otherwise specified, the MATHLIB package installs under C:\ti\ in directory mathlib_c66x_3_1_2_1. The directory structure of the installed package will look similar to that displayed below in Figure 1, though the release notes will match the installation version.


Figure 1. c66x MATHLIB Directory Structure

The files that comprise the MATHLIB installation can be categorized into the following five categories:

  1. Documentation
  2. Component Repository
  3. Kernel Source
  4. Eclipse Support
  5. Internal Meta Data


Installation places all MATHLIB documentation in a Docs directory in the MATHLIB root. The following documentation comes with the delivery:

Files and paths are relative to the MATHLIB root installation directory

Component Repository

The installation creates a Components directory in the MATHLIB root folder. This directory serves as a repository for all packages included in the MATHLIB installation. Each package in this repository is compressed.

Kernel Source

The installation also creates a Packages directory in the MATHLIB root folder. This directory holds all kernels contained within the MATHLIB library. This directory follows the standard TI directory structure. As an example, the files that comprise the MATHLIB kernel atandp will be located, relative to the MATHLIB root installation directory, at packages/ti/mathlib/src/atandp/.

Each Kernel is delivered with a pre-compiled CCSv5 project that illustrates the kernel API and performs several validation tests. Each project provides an estimate of kernel cycle and program memory requirements.

Eclipse Support

The Eclipse directory contains all files required for MATHLIB to be recognized by Eclipse (CCS Version 4) as a plug-in. This is a support directory and can be safely ignored.

Internal Meta Data

The MATHLIB installation creates a Package directory. This directory contains meta information required by the TI packaging tools. This is a support directory and can be safely ignored.

MATHLIB Usage Examples

The examples folder will provide example applications that employ MATHLIB to achieve higher-level mathematical functions.


Since MATHLIB is a collection of individual kernels, any combination of the kernels that comprise MATHLIB may be integrated into a system individually. Integration, for single or multiple kernels, requires four simple steps:

  1. Compile MATHLIB for c66x (optional)
  2. Add API calls within system code
  3. Compile system code
  4. Link MATHLIB

The sections that follow provide details regarding the above four steps.

Compile MATHLIB for c66x (optional)

On installation, the MATHLIB libraries are built and ready to link. Therefore, this step is only required when the original kernel source code has been refined or contributions have been added. See MATHLIB Build Process for details regarding re-building MATHLIB .


Add calls to MATHLIB kernels within the system source code as necessary. Any system source file that contains calls to an MATHLIB kernel will require that the MATHLIB header file mathlib.h is included. See the MATHLIB Function Reference for details on individual kernel APIs.

System Compilation

To re-compile the system code, the path to the packages directory will need to be added to the compiler's include path search list. This path will depend on the MATHLIB root installation directory. This allows the main MATHLIB header file to be moved from within the installation directory and still recognize the individual kernel headers.


The path to the MATHLIB libraries must be provided to the linker via:
-l <MATHLIB_INSTALL_DIR>/packages/ti/mathlib/lib/mathlib.lib

MISRA Compliance

The c66x release complies with MISRA standards as detailed in docs/MATHLIB_c66x_MisraC_Policy.xlsx
Copyright 2016, Texas Instruments Incorporated