Skip to main content

Fixed

Type Alias Fixed 

Source
pub type Fixed = i16;
Expand description

A fixed-point number in Q15 format, suitable for storing results from trigonometric functions.

Q15 maps the range [-32768, 32767] to the mathematical range [-1.0, 1.0):

  • 32767 represents +1.0
  • 0 represents 0.0
  • -32768 represents approximately -1.0

To convert to a float: (fixed_value as f32) / 32767.0

This format is native to 16-bit integer arithmetic and matches the output of all trigonometric functions in this library.