LibLapin's logo

LibLapin

Fixedpoint





The fixedpoint module header is lapin/fixedpoint.h.

Description

     Transform a double or a float to a fixed point decimal number of a specific length and a specific precision.

Parameters

  • const val:
         A float or a double to transform into a fixed point decimal.
  • prec:
         The precision in bits of the fixed point decimal. It is an amount of bits.
  • siz:
         The size in bits of the whole fixed point decimal. The maximum is 64.

Return value

     A fixed point arithemtic decimal number of siz bits, that can be converted back to a float or a double thanks to b‌u‌n‌n‌y‌_‌t‌o‌_‌f‌l‌o‌a‌t‌i‌n‌g‌_‌d‌e‌c‌i‌m‌a‌l.


INDEX


Description

     Transform fixed point decimal number into a double precision floating decimal number.

Parameters

  • const val:
         A fixed point decimal number to be converted.
  • prec:
         The precision in bits of the fixed point decimal. It is an amount of bits.

Return value

     A double with a value that match the send number. You can generate fixed point decimal number with b‌u‌n‌n‌y‌_‌t‌o‌_‌f‌i‌x‌e‌d‌_‌d‌e‌c‌i‌m‌a‌l.


INDEX