HLS Math Library - 2024.1 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2024-07-03
Version
2024.1 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
sqrt      

Error Functions

erf erfc    

Rounding Functions

ceil floor llrint llround
lrint lround nearbyint rint
round trunc    

Remainder Functions

fmod remainder remquo  

Floating-point

copysign nan nextafter nexttoward

Difference Functions

fdim fmax fmin maxmag
minmag      
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