Documentation Portal      

What are you looking for?

Appendix

Fixed-point “Q-format” notation

The UQm.n system is a representation of fixed-point numbers in the Q-format where Q designates a number in the Q-forma notation, U preceding Q indicates an unsigned value, m indicates the number of bits of the integer portion of the number, and n designate the fraction portion the number. For instance, UQ11.5 is an unsigned fixed-point value represented by 16-bit words with 11 integer bits and 5 fractional bits. Other valid notation for UQ11.5 are fx11.16 and 0:11:5.

How to convert “UQ11.5” fixed-point values to floating-point

The UQ11.5 fixed-point values produced by the laser line extractor are 16-bit words representing values with 11 integer bits and 5 fractional bits.

To convert from this format to float, first convert the value to float, then divide by 25 = 32.

float toFloat(unsigned short x) {

    float f = x;

    return f / 32;

}

How to convert “UQ8.8” fixed-point values to floating-point

The UQ8.8 fixed-point values produced by the laser line extractor are 16-bit words representing values with 8 integer bits and 8 fractional bits.

To convert from this format to float, first convert the value to float, then divide by 28 = 256 .

float toFloat(unsigned short x) {

    float f = x;

    return f / 256;

}

© 2018EURESYS s.a.  -  About Documentation  -  Coaxlink 10.3.1.2052