3.5.1.17.9 Standard C Math Library (math.h)

SmartHLS supports a subset of the C Math Library. These functions are supported for functionality, however, may not lead to an efficient hardware implementation. If you require high performance, we recommend restructuring your software code to not call these math functions. For example, you can use the SmartHLSFixed-Point Math Library (see the next section.) The table below shows supported math functions.

Function TypesFunction Names
Trigonometric functionscos, cosf, sin, sinf, tan, tanf, acos, acosf, asin, asinf, atan, atanf, atan2
Hyperbolic functionscosh, coshf, sinh, sinhf, tanh, tanhf, acosh, acoshf, asinh, asinhf, atanh, atanhf
Exponential and logarithmic functionsexp, expf, frexp, log, logf, log10, modf, exp2, expm1, ilogb, log1p, log2, logb, scalbn, scalbln
Power functionspow, powf, sqrt, hypot, cbrt
Error and gamma functionserf, erfc, tgamma
Rounding and remainder functionsceil, floor, fmod, fmodf, trunc, round, lround, llround, rint, lrint, llrint, nearbyint, remainder, remquo
Floating-point manipulation functionscopysign, nan, nextafter
Minimum, maximum, difference functionsfdim, fmax, fmin
Other functionsfabs, fabsf, fma
Implemented as macros in C and as functions in C++Classification macros or functionsisinf, isnan
Comparison macros or functionsisgreater, isgreaterequal, isless, islessequal, islessgreater