Fixed point
Signed Q4.4 fixed-point arithmetic. 0x10 represents 1.0.
import "lib/fixed.nbl";
A Q4.4 value is a signed char with four integer bits and four fractional
bits. q4_4_from_int converts -8..7; q4_4_to_int truncates toward zero.
q4_4_div by zero returns 0.
Functions
Call |
Returns |
Notes |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Convert a signed integer nibble (-8..7) to Q4.4. |
|
|
Convert Q4.4 to a signed integer nibble, truncating toward zero. |
|
|
|
|
|
|
|
|