8.2 Float2Fract

Description

Float2Fract converts a IEEE floating-point single-precision value to a 1.31 fractional value.

Prototype

fractional Float2Fract (float aVal);

Arguments

Parameters

Description

aVal   

IEEE floating-point single-precision value in range

  • [-1, 4.656613 x 10-10] for PIC32A.

Returns

  • 1.15/1.31 fractional numbers depending on the device family
  • 1.31 fractional number in the implicit range [-1, 1 – 2-31]

Remarks

The conversion is performed using a hardware floating-point unit in case of PIC32A and convergent rounding and saturation mechanisms for other devices.

Source File

  • frct2flt_aa.s

System resource usage

  • W0 – used, not restored
  • F0 – F2 used, not restored
  • REPEAT instruction usage – None