HLS Math Library - 2023.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
Release Date
2023.2 English

The following functions are provided in the HLS math library. Each function supports half-precision (type half), single-precision (type float) and double precision (type double).

Important: For each function func listed below, there is also an associated half-precision only function named half_func and single-precision only function named funcf provided in the library.

When mixing half-precision, single-precision and double-precision data types, check for common synthesis errors to prevent introducing type-conversion hardware in the final FPGA implementation.

Trigonometric Functions

acos acospi asin asinpi
atan atan2 atan2pi cos
cospi sin sincos sinpi
tan tanpi    

Hyperbolic Functions

acosh asinh atanh cosh
sinh tanh    

Exponential Functions

exp exp10 exp2 expm1
frexp ldexp modf  

Logarithmic Functions

ilogb log log10 log1p

Power Functions

cbrt hypot pow rsqrt

Error Functions

erf erfc    

Rounding Functions

ceil floor llrint llround
lrint lround nearbyint rint
round trunc    

Remainder Functions

fmod remainder remquo  


copysign nan nextafter nexttoward

Difference Functions

fdim fmax fmin maxmag
Important: Vitis HLS does not support Technical Specification 18661-1 sNaN handling in fmin/fmax yet, This can lead to result differences when compared with glibc 2.25 and later results.

Other Functions

abs divide fabs fma
fract mad recip  

Classification Functions

fpclassify isfinite isinf isnan
isnormal signbit    

Comparison Functions

isgreater isgreaterequal isless islessequal
islessgreater isunordered    

Relational Functions

all any bitselect isequal
isnotequal isordered select