![]()  | 
  
    Documentation
    
   Tools for embedded systems 
   | 
 
Fixed-point Q16.16 type with width of exactly 32 bits. More...
#include <fp16.hpp>
Public Member Functions | |
| constexpr | fp16 () | 
| fp16 (const fp16 &other) | |
| bool | isOverflow (void) const noexcept | 
| Check for (q16.16) fixed-point overflow.   | |
| bool | isExpMax (void) const noexcept | 
Check for (q16.16) fixed-point fp16::exp() operation reaches the EXP_MAX value.   | |
| fp16Raw_t | raw (void) const noexcept | 
| Get the (q16.16) raw integer value from x.   | |
Static Public Member Functions | |
| static int | toInt (const fp16 &x) noexcept | 
| Returns the fixed-point value x converted to int.   | |
| static float | toFloat (const fp16 &x) noexcept | 
| Returns the fixed-point value x converted to float.   | |
| static double | toDouble (const fp16 &x) noexcept | 
| Returns the fixed-point value x converted to double.   | |
| static fp16 | from (const int x) noexcept | 
| Returns the int value x converted to fixed-point q16.16.   | |
| static fp16 | from (const float x) noexcept | 
| Returns the float value x converted to fixed-point q16.16.   | |
| static fp16 | from (const double x) noexcept | 
| Returns the double value x converted to fixed-point q16.16.   | |
| static fp16 | floor (const fp16 &x) noexcept | 
| Returns the largest integer value less than or equal to x.   | |
| static fp16 | ceil (const fp16 &x) noexcept | 
| static fp16 | rounding (const fp16 &x) noexcept | 
| Returns the nearest integer value of the fixed-point argument x.   | |
| static fp16 | absolute (const fp16 &x) noexcept | 
| Returns the absolute value of x.   | |
| static fp16 | sqrt (const fp16 &x) noexcept | 
| Returns the fixed-point square root of x.   | |
| static fp16 | exp (const fp16 &x) noexcept | 
| Returns the fixed-point value of e raised to the xth power.   | |
| static fp16 | log (const fp16 &x) noexcept | 
| Returns the fixed-point natural logarithm (base-e logarithm) of x.   | |
| static fp16 | log2 (const fp16 &x) noexcept | 
| Returns the fixed-point log base 2 of x.   | |
| static fp16 | radToDeg (const fp16 &x) noexcept | 
| Converts angle units from radians to degrees.   | |
| static fp16 | degToRad (const fp16 &x) noexcept | 
| Converts angle units from degrees to radians.   | |
| static fp16 | wrapToPi (const fp16 &x) noexcept | 
| Wrap the fixed-point angle in radians to [−pi pi].   | |
| static fp16 | wrapTo180 (const fp16 &x) noexcept | 
| Wrap the fixed-point angle in degrees to [−180 180].   | |
| static fp16 | sin (const fp16 &x) noexcept | 
| Computes the fixed-point sine of the radian angle x.   | |
| static fp16 | cos (const fp16 &x) noexcept | 
| Computes the fixed-point cosine of the radian angle x.   | |
| static fp16 | tan (const fp16 &x) noexcept | 
| Computes the fixed-point tangent of the radian angle x.   | |
| static fp16 | atan2 (const fp16 &y, const fp16 &x) noexcept | 
| Computes the fixed-point arc tangent in radians of y / x based on the signs of both values to determine the correct quadrant.   | |
| static fp16 | atan (const fp16 &x) noexcept | 
| Computes the fixed-point arc tangent of x in radians.   | |
| static fp16 | asin (const fp16 &x) noexcept | 
| Computes the fixed-point arc sine of x in radians.   | |
| static fp16 | acos (const fp16 &x) noexcept | 
| Computes the fixed-point arc cosine of x in radians.   | |
| static fp16 | cosh (const fp16 &x) noexcept | 
| Computes the fixed-point hyperbolic cosine of x.   | |
| static fp16 | sinh (const fp16 &x) noexcept | 
| Computes the fixed-point hyperbolic sine of x.   | |
| static fp16 | tanh (const fp16 &x) noexcept | 
| Computes the fixed-point hyperbolic tangent of x.   | |
| static fp16 | pow (const fp16 &x, const fp16 &y) noexcept | 
| Returns x raised to the power of y. (x^y)   | |
| static char * | toASCII (const fp16 &x, char *str, int decimals) noexcept | 
| Converts the fixed-point value to a formatted string.   | |
Fixed-point Q16.16 type with width of exactly 32 bits.
      
  | 
  inlineconstexpr | 
      
  | 
  inline | 
Returns the absolute value of x.
| [in] | x | The fixed-point(q16.16) value. | 
Computes the fixed-point arc cosine of x in radians.
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in radians. | 
Computes the fixed-point arc sine of x in radians.
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in radians. | 
Computes the fixed-point arc tangent of x in radians.
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in radians. | 
Computes the fixed-point arc tangent in radians of y / x based on the signs of both values to determine the correct quadrant.
| [in] | y | The fixed-point(q16.16) value representing an x-coordinate. | 
| [in] | x | The fixed-point(q16.16) value representing an y-coordinate. | 
Computes the fixed-point cosine of the radian angle x.
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in radians. | 
Computes the fixed-point hyperbolic cosine of x.
| [in] | x | The fixed-point(q16.16) value. | 
overflow. If the function saturates, returns EXP_MAX or EXP_MIN. Converts angle units from degrees to radians.
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in degrees. | 
Returns the fixed-point value of e raised to the xth power.
| [in] | x | The fixed-point(q16.16) value. | 
overflow when an operation overflow is detected. Returns the largest integer value less than or equal to x.
| [in] | x | The fixed-point(q16.16) value. | 
      
  | 
  inlinestaticnoexcept | 
Returns the double value x converted to fixed-point q16.16.
| [in] | x | The double precision floating-point value. | 
      
  | 
  inlinestaticnoexcept | 
Returns the float value x converted to fixed-point q16.16.
| [in] | x | The floating-point value. | 
      
  | 
  inlinestaticnoexcept | 
Returns the int value x converted to fixed-point q16.16.
| [in] | x | The integer value. | 
      
  | 
  inlinenoexcept | 
Check for (q16.16) fixed-point fp16::exp() operation reaches the EXP_MAX value. 
true if the fixed-point has reached EXP_MAX, otherwise false. 
      
  | 
  inlinenoexcept | 
Check for (q16.16) fixed-point overflow.
true if the fixed-point has overflowed otherwise false. Returns the fixed-point natural logarithm (base-e logarithm) of x.
| [in] | x | The fixed-point(q16.16) value. | 
overflow Returns the fixed-point log base 2 of x.
| [in] | x | The fixed-point(q16.16) value. | 
overflow Returns x raised to the power of y. (x^y)
| [in] | x | The fixed-point(q16.16) base value. | 
| [in] | y | The fixed-point(q16.16) power value. | 
overflow when an operation overflow is detected. Converts angle units from radians to degrees.
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in radians. | 
      
  | 
  inlinenoexcept | 
Get the (q16.16) raw integer value from x.
Returns the nearest integer value of the fixed-point argument x.
| [in] | x | The fixed-point(q16.16) value. | 
Computes the fixed-point sine of the radian angle x.
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in radians. | 
Computes the fixed-point hyperbolic sine of x.
| [in] | x | The fixed-point(q16.16) value. | 
overflow. If the function saturates, returns EXP_MAX or EXP_MIN. Returns the fixed-point square root of x.
| [in] | x | The fixed-point(q16.16) value. | 
overflow. Computes the fixed-point tangent of the radian angle x.
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in radians. | 
Computes the fixed-point hyperbolic tangent of x.
| [in] | x | The fixed-point(q16.16) value. | 
overflow. If the function saturates, returns EXP_MAX or EXP_MIN. 
      
  | 
  inlinestaticnoexcept | 
Converts the fixed-point value to a formatted string.
| [in] | x | The fixed-point(q16.16) value to be converted to string. | 
| [in] | str | Array in memory where to store the resulting null-terminated string. | 
| [in] | decimals | Number of decimals to show in the string representation. | 
      
  | 
  staticnoexcept | 
Returns the fixed-point value x converted to double.
| [in] | x | The fixed-point(q16.16) value. | 
      
  | 
  staticnoexcept | 
Returns the fixed-point value x converted to float.
| [in] | x | The fixed-point(q16.16) value. | 
      
  | 
  staticnoexcept | 
Returns the fixed-point value x converted to int.
| [in] | x | The fixed-point(q16.16) value. | 
Wrap the fixed-point angle in degrees to [−180 180].
| [in] | x | The fixed-point(q16.16) value representing an angle expressed in degrees. |