在 HLS 数学库中提供了以下函数。其中每个函数都支持半精度(half
类型)、单精度(float
类型)和双精度(double
类型)。
重要: 对于下列每个 func
函数,库中还提供了 1 个关联的仅限半精度函数(名为 half_func
)和 1 个仅限单精度函数(名为 funcf
)。
混用半精度、单精度和双精度数据类型时,请检查常见综合错误,防止在最终 FPGA 实现中引入类型转换硬件。
三角函数
acos |
acospi |
asin |
asinpi |
atan |
atan2 |
atan2pi |
cos |
cospi |
sin |
sincos |
sinpi |
tan |
tanpi |
|
|
双曲函数
acosh |
asinh |
atanh |
cosh |
sinh |
tanh |
|
|
指数函数
exp |
exp10 |
exp2 |
expm1 |
frexp |
ldexp |
modf |
|
幂函数
cbrt |
hypot |
pow |
rsqrt |
sqrt |
|
|
|
舍入函数
ceil |
floor |
llrint |
llround |
lrint |
lround |
nearbyint |
rint |
round |
trunc |
|
|
浮点
copysign |
nan |
nextafter |
nexttoward |
差分函数
fdim |
fmax |
fmin |
maxmag |
minmag |
|
|
|
其它函数
abs |
divide |
fabs |
fma |
fract |
mad |
recip |
|
分类函数
fpclassify |
isfinite |
isinf |
isnan |
isnormal |
signbit |
|
|
比较函数
isgreater |
isgreaterequal |
isless |
islessequal |
islessgreater |
isunordered |
|
|
关系函数
all |
any |
bitselect |
isequal |
isnotequal |
isordered |
select |
|