Intel® High Level Synthesis Compiler Pro Edition: Reference Manual

ID 683349
Date 4/01/2024
Public
Document Table of Contents

B. Supported Math Functions

The Intel® HLS Compiler has built-in support for generating efficient IP out of standard math functions present in the math.h C header file. The compiler also has support for some math functions that are not supported by the math.h header file, and these functions are provided in extendedmath.h C header file.
To use the Intel® implementation of math.h for Intel FPGAs, include HLS/math.h in your function by adding the following line:
#include "HLS/math.h"
To use the nonstandard math functions that are optimized for Intel FPGAs, include HLS/extendedmath.h in your function by adding the following line:
#include "HLS/extendedmath.h"
The extendedmath.h header is compatible only with Intel® HLS Compiler. It is not compatible with GCC or Microsoft Visual Studio.
If your component uses arbitrary precision fixed-point datatypes provided in the ac_fixed.h header, you use some of the datatypes with some math functions by including the following line:
#include "HLS/ac_fixed_math.h"

To see examples of how to use the math functions provided by these header files, review the following tutorial: <quartus_installdir>/hls/examples/tutorials/best_practices/single_vs_double_precision_math.

If your component uses the hls_float arbitrary precision floating point data type, add the following line to add support for math functions:
#include "HLS/hls_float_math.h"