メイン・コンテンツまでスキップ

Q15

touchgfx/widgets/canvas/CWRUtil.hpp

Defines a "floating point number" with 15 bits reserved for the fractional part of the decimal number. Q15 is only used for sine/cosine and for intermediate calculations when multiplying.

Q5*Q5=Q10, Q10/Q5=Q5, ...

See: Q5, Q10

Public Functions

operator int() const
Gets the Q15 as an integer without conversion.
Q15operator+(const Q15 & q15) const
Addition operator.
Q15operator-() const
Negation operator.
Q10operator/(const Q5 & q5) const
Calculate Q15 / Q5 as a Q10.
Q15(int i)
Constructor from integer.

Public Functions Documentation

operator int

Gets the Q15 as an integer without conversion.

Returns:

The unconverted Q15 value.

operator+

Q15 operator+(const Q15 &q15)

Addition operator.

Parameters:
q15The Q15 to add to this.
Returns:

The result of the operation.

operator-

Q15 operator-()const

Negation operator.

Returns:

The negative value of this.

operator/

Q10 operator/(const Q5 &q5)

Calculate Q15 / Q5 as a Q10.

Parameters:
q5The Q5 to divide this by.
Returns:

The result of the operation.

Q15

explicit Q15(inti)

Constructor from integer.

No conversion is done - the integer is assumed to already be in Q15 format.

Parameters:
iint pre-formattet in Q15 format.