Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Scalar API quick reference

- Scalar Type Conversion

- Fixed-Point Scalar Ops

- IEEE 754 Float Scalar Ops

- Non-standard Float Scalar Ops

- Non-standard Complex Float Scalar Ops

## Scalar type conversion

Table 10 Scalar type conversion
Function | Type In | Type Out
--- | --- | ---
`f32_unpack()` | `float` | `int32_t`, `exponent_t`
`f32_unpack_s16()` | `float` | `int16_t`, `exponent_t`
`f32_to_float_s32()` | `float` | `float_s32_t`
`f64_to_float_s32()` | `double` | `float_s32_t`
`float_s32_to_float_s64()` | `float_s32_t` | `float_s64_t`
`float_s32_to_float()` | `float_s32_t` | `float`
`float_s32_to_double()` | `float_s32_t` | `double`
`s16_to_s32()` | `int16_t`, `exponent_t` | `int32_t`, `exponent_t`
`s32_to_s16()` | `int32_t`, `exponent_t` | `int16_t`, `exponent_t`
`s64_to_s32()` | `int64_t`, `exponent_t` | `int32_t`, `exponent_t`
`s32_to_f32()` | `int32_t`, `exponent_t` | `float`
`radians_to_sbrads()` | `radian_q24_t` | `sbrad_t`
`s32_to_chunk_s32()` | `int32_t` | `int32_t[8]`
`float_s64_to_float_s32()` | `float_s64_t` | `float_s32_t`

## Fixed-point scalar ops

Table 11 Fixed-point scalar ops
Function | Input Depth | Fractional Bits | Brief
--- | --- | --- | ---
`s16_inverse()` | 16 | 0 | \(x^{-1}\)
`s32_inverse()` | 32 | 0 | \(x^{-1}\)
`sbrad_sin()` | 32 | 31 | \(\sin(x)\)
`sbrad_tan()` | 32 | 31 | \(\tan(x)\)
`q24_sin()` | 32 | 24 | \(\sin(x)\)
`q24_cos()` | 32 | 24 | \(\cos(x)\)
`q24_tan()` | 32 | 24 | \(\tan(x)\)
`q30_exp_small()` | 32 | 30 | \(\exp(x)\)
`q24_logistic()` | 32 | 24 | \(\frac{1}{1+e^{-x}}\)
`q24_logistic_fast()` | 32 | 24 | \(\frac{1}{1+e^{-x}}\)
`q30_powers()` | 32 | 30 | \((0,x,x^2,x^3,\dots)\)
`u32_ceil_log2()` | 32 | 0 | \(\lceil\log_2(x)\rceil\)

## IEEE 754 float ops

Table 12 IEEE 754 float ops
Function | Brief
--- | ---
`f32_sin()` | \(sin(x)\)
`f32_cos()` | \(cos(x)\)
`f32_log2()` | \(log_2(x)\)
`f32_power_series()` | Evaluate Power Series
`f32_normA()` | Normalized Form A

## Non-standard scalar float ops

Table 13 Non-standard scalar float ops
Function | Brief
--- | ---
`float_s32_mul()` | \(x \times y\)
`float_s32_add()` | \(x + y\)
`float_s32_sub()` | \(x - y\)
`float_s32_div()` | \(\frac{x}{y}\)
`float_s32_abs()` | \(\left|x\right|\)
`float_s32_gt()` | \(x > y\)
`float_s32_gte()` | \(x \ge y\)
`float_s32_ema()` | \(\alpha x + (1 - \alpha) y\)
`float_s32_sqrt()` | \(\sqrt{x}\)
`float_s32_exp()` | \(exp(x)\)
`s16_mul()` | \(x \times y\)
`s32_sqrt()` | \(\sqrt{x}\)
`s32_mul()` | \(x \times y\)
`s32_odd_powers()` | \(x, x^3, x^5, x^7, \dots\)

## Non-standard complex scalar float ops

Table 14 Non-standard complex scalar float ops
Function | Brief
--- | ---
`float_complex_s16_mul()` | \(x \times y\)
`float_complex_s16_add()` | \(x + y\)
`float_complex_s16_sub()` | \(x - y\)
`float_complex_s32_mul()` | \(x \times y\)
`float_complex_s32_add()` | \(x + y\)
`float_complex_s32_sub()` | \(x - y\)