embassy-rp

Crates

git

Versions

rp2040

Flavors

Module float_funcs

Source
Expand description

ROM functions using single-precision arithmetic (i.e. ‘f32’ in Rust terms)

Modules§

fadd
Additional access for the fadd ROM function.
fatan2
Additional access for the fatan2 ROM function.
fcmp
Additional access for the fcmp ROM function.
fcos
Additional access for the fcos ROM function.
fdiv
Additional access for the fdiv ROM function.
fexp
Additional access for the fexp ROM function.
fix64_to_float
Additional access for the fix64_to_float ROM function.
fix_to_float
Additional access for the fix_to_float ROM function.
fln
Additional access for the fln ROM function.
float_to_double
Additional access for the float_to_double ROM function.
float_to_fix
Additional access for the float_to_fix ROM function.
float_to_fix64
Additional access for the float_to_fix64 ROM function.
float_to_int
Additional access for the float_to_int ROM function.
float_to_int64
Additional access for the float_to_int64 ROM function.
float_to_ufix
Additional access for the float_to_ufix ROM function.
float_to_ufix64
Additional access for the float_to_ufix64 ROM function.
float_to_uint
Additional access for the float_to_uint ROM function.
float_to_uint64
Additional access for the float_to_uint64 ROM function.
fmul
Additional access for the fmul ROM function.
fsin
Additional access for the fsin ROM function.
fsqrt
Additional access for the fsqrt ROM function.
fsub
Additional access for the fsub ROM function.
ftan
Additional access for the ftan ROM function.
int64_to_float
Additional access for the int64_to_float ROM function.
int_to_float
Additional access for the int_to_float ROM function.
ufix64_to_float
Additional access for the ufix64_to_float ROM function.
ufix_to_float
Additional access for the ufix_to_float ROM function.
uint64_to_float
Additional access for the uint64_to_float ROM function.
uint_to_float
Additional access for the uint_to_float ROM function.

Functions§

fadd
Calculates a + b
fatan2
Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant
fcmp
Compares two floating point numbers, returning: • 0 if a == b • -1 if a < b • 1 if a > b
fcos
Calculates the cosine of angle. The value of angle is in radians, and must be in the range -1024 to 1024
fdiv
Calculates a / b
fexp
Calculates the exponential value of v, i.e. e ** v
fix64_to_float
Converts a signed fixed point 64-bit integer representation to the nearest f32 value, rounding to even on tie. n specifies the position of the binary point in fixed point, so f = nearest(v/(2^n))
fix_to_float
Converts a signed fixed point integer representation to the nearest f32 value, rounding to even on tie. n specifies the position of the binary point in fixed point, so f = nearest(v/(2^n))
fln
Calculates the natural logarithm of v. If v <= 0 return -Infinity
float_to_double
Converts an f32 to an f64.
float_to_fix
Converts an f32 to an signed fixed point integer representation where n specifies the position of the binary point in the resulting fixed point representation, e.g. f(0.5f, 16) == 0x8000. This method rounds towards -Infinity, and clamps the resulting integer to lie within the range 0x00000000 to 0xFFFFFFFF
float_to_fix64
Converts an f32 to a signed fixed point 64-bit integer representation where n specifies the position of the binary point in the resulting fixed point representation - e.g. f(0.5f, 16) == 0x8000. This method rounds towards -Infinity, and clamps the resulting integer to lie within the range -0x8000000000000000 to 0x7FFFFFFFFFFFFFFF
float_to_int
Converts an f32 to a signed integer, rounding towards -Infinity, and clamping the result to lie within the range -0x80000000 to 0x7FFFFFFF
float_to_int64
Convert an f32 to a signed 64-bit integer, rounding towards -Infinity, and clamping the result to lie within the range -0x8000000000000000 to 0x7FFFFFFFFFFFFFFF
float_to_ufix
Converts an f32 to an unsigned fixed point integer representation where n specifies the position of the binary point in the resulting fixed point representation, e.g. f(0.5f, 16) == 0x8000. This method rounds towards -Infinity, and clamps the resulting integer to lie within the range 0x00000000 to 0xFFFFFFFF
float_to_ufix64
Converts an f32 to an unsigned fixed point 64-bit integer representation where n specifies the position of the binary point in the resulting fixed point representation, e.g. f(0.5f, 16) == 0x8000. This method rounds towards -Infinity, and clamps the resulting integer to lie within the range 0x0000000000000000 to 0xFFFFFFFFFFFFFFFF
float_to_uint
Converts an f32 to an unsigned integer, rounding towards -Infinity, and clamping the result to lie within the range 0x00000000 to 0xFFFFFFFF
float_to_uint64
Converts an f32 to an unsigned 64-bit integer, rounding towards -Infinity, and clamping the result to lie within the range 0x0000000000000000 to 0xFFFFFFFFFFFFFFFF
fmul
Calculates a * b
fsin
Calculates the sine of angle. The value of angle is in radians, and must be in the range -1024 to 1024
fsqrt
Calculates sqrt(v) (or return -Infinity if v is negative)
fsub
Calculates a - b
ftan
Calculates the tangent of angle. The value of angle is in radians, and must be in the range -1024 to 1024
int64_to_float
Converts a signed 64-bit integer to the nearest f32 value, rounding to even on tie
int_to_float
Converts a signed integer to the nearest f32 value, rounding to even on tie
ufix64_to_float
Converts an unsigned fixed point 64-bit integer representation to the nearest f32 value, rounding to even on tie. n specifies the position of the binary point in fixed point, so f = nearest(v/(2^n))
ufix_to_float
Converts an unsigned fixed point integer representation to the nearest f32 value, rounding to even on tie. n specifies the position of the binary point in fixed point, so f = nearest(v/(2^n))
uint64_to_float
Converts an unsigned 64-bit integer to the nearest f32 value, rounding to even on tie
uint_to_float
Converts an unsigned integer to the nearest f32 value, rounding to even on tie