Fp

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

Macros | Typedefs | Functions
Fp
Eina » Data Types

Floating point numbers data type management. More...

## Macros
#define | EINA_F32P32_PI 0x00000003243f6a89
| Yields the 32-bit PI constant.
#define | eina_fp32p32_llabs(a) ((a < 0) ? -(a) : (a))
| Get the absolute value of an Eina_F32p32 floating point number. More...
#define | EINA_F16P16_ONE (1 << 16)
| Yields the maximum 16-bit unsigned integer size (= 65536)
#define | EINA_F16P16_HALF (1 << 15)
| Yields the maximum 16-bit signed integer size (= 32768)

## Typedefs
typedef int64_t | Eina_F32p32
| Type for floating point number where the size of the integer part is 32-bit and the size of the decimal part is 32-bit.
typedef int32_t | Eina_F16p16
| Type for floating point number where the size of the integer part is 16-bit and the size of the decimal part is 16-bit.
typedef int32_t | Eina_F8p24
| Type for floating point number where the size of the integer part is 8-bit and the size of the decimal part is 24bits.

## Functions
static Eina_F32p32 | eina_f32p32_int_from (int32_t v)
| Create a new Eina_F32p32 floating point number from standard 32-bit integer. More...
static int32_t | eina_f32p32_int_to (Eina_F32p32 v)
| Create a new standard 32-bit integer from Eina_F32p32 floating point number. More...
static Eina_F32p32 | eina_f32p32_double_from (double v)
| Create a new Eina_F32p32 floating point number from standard double. More...
static double | eina_f32p32_double_to (Eina_F32p32 v)
| Create a new standard double from Eina_F32p32 floating point number. More...
static Eina_F32p32 | eina_f32p32_add (Eina_F32p32 a, Eina_F32p32 b)
| Calculates the sum of two Eina_F32p32 floating point numbers. More...
static Eina_F32p32 | eina_f32p32_sub (Eina_F32p32 a, Eina_F32p32 b)
| Calculates the substraction of two Eina_F32p32 floating point numbers. More...
static Eina_F32p32 | eina_f32p32_mul (Eina_F32p32 a, Eina_F32p32 b)
| Calculates the multiplication of two Eina_F32p32 floating point numbers. More...
static Eina_F32p32 | eina_f32p32_scale (Eina_F32p32 a, int b)
| Calculates the scale multiplication of one Eina_F32p32 floating point number with an integer. More...
static Eina_F32p32 | eina_f32p32_div (Eina_F32p32 a, Eina_F32p32 b)
| Calculates the division of two Eina_F32p32 floating point numbers. More...
static Eina_F32p32 | eina_f32p32_sqrt (Eina_F32p32 a)
| Calculates the square root of an Eina_F32p32 floating point number. More...
static unsigned int | eina_f32p32_fracc_get (Eina_F32p32 v)
| Get the absolute value of the integer part of and Eina_F32p32 floating point number. More...
EAPI Eina_F32p32 | eina_f32p32_cos (Eina_F32p32 a)
| Calculates the cosinus of a floating point number. More...
EAPI Eina_F32p32 | eina_f32p32_sin (Eina_F32p32 a)
| Calculates the sinus of a floating point number. More...
static Eina_F16p16 | eina_f16p16_int_from (int32_t v)
| Create a new Eina_F16p316 floating point number from standard 32-bit integer. More...
static int32_t | eina_f16p16_int_to (Eina_F16p16 v)
| Create a new standard 32-bit integer from Eina_F16p16 floating point number. More...
static Eina_F16p16 | eina_f16p16_double_from (double v)
| Create a new Eina_F16p16 floating point number from standard double. More...
static double | eina_f16p16_double_to (Eina_F16p16 v)
| Create a new standard double from Eina_F16p16 floating point number. More...
static Eina_F16p16 | eina_f16p16_float_from (float v)
| Create a new Eina_F16p16 floating point number from standard float. More...
static float | eina_f16p16_float_to (Eina_F16p16 v)
| Create a new standard float from Eina_F16p16 floating point number. More...
static Eina_F16p16 | eina_f16p16_add (Eina_F16p16 a, Eina_F16p16 b)
| Calculates the sum of two Eina_F16p16 floating point numbers. More...
static Eina_F16p16 | eina_f16p16_sub (Eina_F16p16 a, Eina_F16p16 b)
| Calculates the substraction of two Eina_F16p16 floating point numbers. More...
static Eina_F16p16 | eina_f16p16_mul (Eina_F16p16 a, Eina_F16p16 b)
| Calculates the multiplication of two Eina_F16p16 floating point numbers. More...
static Eina_F16p16 | eina_f16p16_scale (Eina_F16p16 a, int b)
| Calculates the scale multiplication of one Eina_F16p16 floating point number with an integer. More...
static Eina_F16p16 | eina_f16p16_div (Eina_F16p16 a, Eina_F16p16 b)
| Calculates the division of two Eina_F16p16 floating point numbers. More...
static Eina_F16p16 | eina_f16p16_sqrt (Eina_F16p16 a)
| Calculates the square root of an Eina_F16p16 floating point number. More...
static unsigned int | eina_f16p16_fracc_get (Eina_F16p16 v)
| Get the absolute value of the integer part of and Eina_F16p16 floating point number. More...
static Eina_F8p24 | eina_f8p24_int_from (int32_t v)
| Create a new Eina_F16p316 floating point number from standard 32-bit integer. More...
static int32_t | eina_f8p24_int_to (Eina_F8p24 v)
| Create a new standard 32-bit integer from Eina_F8p24 floating point number. More...
static Eina_F8p24 | eina_f8p24_float_from (float v)
| Create a new Eina_F8p24 floating point number from standard float. More...
static float | eina_f8p24_float_to (Eina_F8p24 v)
| Create a new standard float from Eina_F8p24 floating point number. More...
static Eina_F8p24 | eina_f8p24_add (Eina_F8p24 a, Eina_F8p24 b)
| Calculates the sum of two Eina_F8p24 floating point numbers. More...
static Eina_F8p24 | eina_f8p24_sub (Eina_F8p24 a, Eina_F8p24 b)
| Calculates the substraction of two Eina_F8p24 floating point numbers. More...
static Eina_F8p24 | eina_f8p24_mul (Eina_F8p24 a, Eina_F8p24 b)
| Calculates the multiplication of two Eina_F8p24 floating point numbers. More...
static Eina_F8p24 | eina_f8p24_scale (Eina_F8p24 a, int b)
| Calculates the scale multiplication of one Eina_F8p24 floating point number with an integer. More...
static Eina_F8p24 | eina_f8p24_div (Eina_F8p24 a, Eina_F8p24 b)
| Calculates the division of two Eina_F8p24 floating point numbers. More...
static Eina_F8p24 | eina_f8p24_sqrt (Eina_F8p24 a)
| Calculates the square root of an Eina_F8p24 floating point number. More...
static unsigned int | eina_f8p24_fracc_get (Eina_F8p24 v)
| Get the absolute value of the integer part of and Eina_F8p24 floating point number. More...
static Eina_F32p32 | eina_f16p16_to_f32p32 (Eina_F16p16 a)
| Converts an Eina_F16p16 floating point number into Eina_F32p32 format. More...
static Eina_F32p32 | eina_f8p24_to_f32p32 (Eina_F8p24 a)
| Converts an Eina_F8p24 floating point number into Eina_F32p32 format. More...
static Eina_F16p16 | eina_f32p32_to_f16p16 (Eina_F32p32 a)
| Converts an Eina_F32p32 floating point number into Eina_F16p16 format. More...
static Eina_F16p16 | eina_f8p24_to_f16p16 (Eina_F8p24 a)
| Converts an Eina_F8p24 floating point number into Eina_F16p16 format. More...
static Eina_F8p24 | eina_f32p32_to_f8p24 (Eina_F32p32 a)
| Converts an Eina_F32p32 floating point number into Eina_F8p24 format. More...
static Eina_F8p24 | eina_f16p16_to_f8p24 (Eina_F16p16 a)
| Converts an Eina_F16p16 floating point number into Eina_F8p16 format. More...

## Detailed Description

Floating point numbers data type management.

## Macro Definition Documentation

#define eina_fp32p32_llabs | ( |  | a | ) | ((a < 0) ? -(a) : (a))

Get the absolute value of an Eina_F32p32 floating point number.

Parameters

  a | The floating point number

Returns
  The absolute value for the number `a`

Warning
  Has known issues on 64-bit architecture, prefer eina_f32p32_fracc_get() instead

Referenced by eina_f32p32_cos().

## Function Documentation

static Eina_F32p32 eina_f32p32_int_from | ( | int32_t | v | ) |
| inlinestatic

Create a new Eina_F32p32 floating point number from standard 32-bit integer.

Parameters

  v | 32-bit integer value to convert

Returns
  The value converted into Eina_F32p32 format

static int32_t eina_f32p32_int_to | ( | Eina_F32p32 | v | ) |
| inlinestatic

Create a new standard 32-bit integer from Eina_F32p32 floating point number.

Parameters

  v | Eina_F32p32 value to convert

Returns
  The value converted into 32-bit integer

Referenced by eina_f32p32_cos().

static Eina_F32p32 eina_f32p32_double_from | ( | double | v | ) |
| inlinestatic

Create a new Eina_F32p32 floating point number from standard double.

Parameters

  v | double value to convert

Returns
  The value converted into Eina_F32p32 format

static double eina_f32p32_double_to | ( | Eina_F32p32 | v | ) |
| inlinestatic

Create a new standard double from Eina_F32p32 floating point number.

Parameters

  v | Eina_F32p32 value to convert

Returns
  The value converted into double

static Eina_F32p32 eina_f32p32_add | ( | Eina_F32p32 | a,
|  | Eina_F32p32 | b
| ) |  |
| inlinestatic

Calculates the sum of two Eina_F32p32 floating point numbers.

Parameters

  a | The first number
  b | The second number

Returns
  The sum result of the two numbers `a` + `b`

Referenced by eina_f32p32_cos().

static Eina_F32p32 eina_f32p32_sub | ( | Eina_F32p32 | a,
|  | Eina_F32p32 | b
| ) |  |
| inlinestatic

Calculates the substraction of two Eina_F32p32 floating point numbers.

Parameters

  a | The first number
  b | The substracted number

Returns
  The substaction result of the two numbers `a` - `b`

Referenced by eina_f32p32_cos(), and eina_f32p32_sin().

static Eina_F32p32 eina_f32p32_mul | ( | Eina_F32p32 | a,
|  | Eina_F32p32 | b
| ) |  |
| inlinestatic

Calculates the multiplication of two Eina_F32p32 floating point numbers.

Parameters

  a | The first number
  b | The second number

Returns
  The mutliplication result of the two numbers `a` * `b`

To prevent overflow during multiplication we need to reduce the precision of the fraction part Shift both values to only contain 16 bit of the fraction part (rounded). After multiplication we again have a value with a 32-bit fraction part.

Referenced by eina_f32p32_cos().

static Eina_F32p32 eina_f32p32_scale | ( | Eina_F32p32 | a,
|  | int | b
| ) |  |
| inlinestatic

Calculates the scale multiplication of one Eina_F32p32 floating point number with an integer.

Parameters

  a | The Eina_F32p32 number
  b | The integer value

Returns
  The mutliplication result of the two numbers `a` * `b`

Referenced by eina_f32p32_cos().

static Eina_F32p32 eina_f32p32_div | ( | Eina_F32p32 | a,
|  | Eina_F32p32 | b
| ) |  |
| inlinestatic

Calculates the division of two Eina_F32p32 floating point numbers.

Parameters

  a | The numerator number
  b | The denominator number

Returns
  The division result of the two numbers `a` / `b`

Referenced by eina_f32p32_cos().

static Eina_F32p32 eina_f32p32_sqrt | ( | Eina_F32p32 | a | ) |
| inlinestatic

Calculates the square root of an Eina_F32p32 floating point number.

Parameters

  a | The number to calculate the square root from

Returns
  The square root result for the number `a`

static unsigned int eina_f32p32_fracc_get | ( | Eina_F32p32 | v | ) |
| inlinestatic

Get the absolute value of the integer part of and Eina_F32p32 floating point number.

Parameters

  a | The floating point number

Returns
  The positive integer part of the number `a`

Referenced by eina_f32p32_cos().

EAPI Eina_F32p32 eina_f32p32_cos | ( | Eina_F32p32 | a | ) |

Calculates the cosinus of a floating point number.

Parameters

  a | The angle in radians to calculate the cosinus from.

Returns
  The cosinus value of the angle `a`

References eina_f32p32_add(), eina_f32p32_div(), eina_f32p32_fracc_get(), eina_f32p32_int_to(), eina_f32p32_mul(), EINA_F32P32_PI, eina_f32p32_scale(), eina_f32p32_sub(), and eina_fp32p32_llabs.

Referenced by eina_f32p32_sin().

EAPI Eina_F32p32 eina_f32p32_sin | ( | Eina_F32p32 | a | ) |

Calculates the sinus of a floating point number.

Parameters

  a | The angle in radians to calculate the sinus from.

Returns
  The cosinus value of the angle `a`

References eina_f32p32_cos(), EINA_F32P32_PI, and eina_f32p32_sub().

static Eina_F16p16 eina_f16p16_int_from | ( | int32_t | v | ) |
| inlinestatic

Create a new Eina_F16p316 floating point number from standard 32-bit integer.

Parameters

  v | 32-bit integer value to convert

Returns
  The value converted into Eina_F16p16 format

static int32_t eina_f16p16_int_to | ( | Eina_F16p16 | v | ) |
| inlinestatic

Create a new standard 32-bit integer from Eina_F16p16 floating point number.

Parameters

  v | Eina_F16p16 value to convert

Returns
  The value converted into 32-bit integer

static Eina_F16p16 eina_f16p16_double_from | ( | double | v | ) |
| inlinestatic

Create a new Eina_F16p16 floating point number from standard double.

Parameters

  v | double value to convert

Returns
  The value converted into Eina_F16p16 format

Referenced by eina_matrix3_fixed_values_get().

static double eina_f16p16_double_to | ( | Eina_F16p16 | v | ) |
| inlinestatic

Create a new standard double from Eina_F16p16 floating point number.

Parameters

  v | Eina_F16p16 value to convert

Returns
  The value converted into double

static Eina_F16p16 eina_f16p16_float_from | ( | float | v | ) |
| inlinestatic

Create a new Eina_F16p16 floating point number from standard float.

Parameters

  v | float value to convert

Returns
  The value converted into Eina_F16p16 format

static float eina_f16p16_float_to | ( | Eina_F16p16 | v | ) |
| inlinestatic

Create a new standard float from Eina_F16p16 floating point number.

Parameters

  v | Eina_F16p16 value to convert

Returns
  The value converted into float

static Eina_F16p16 eina_f16p16_add | ( | Eina_F16p16 | a,
|  | Eina_F16p16 | b
| ) |  |
| inlinestatic

Calculates the sum of two Eina_F16p16 floating point numbers.

Parameters

  a | The first number
  b | The second number

Returns
  The sum result of the two numbers `a` + `b`

static Eina_F16p16 eina_f16p16_sub | ( | Eina_F16p16 | a,
|  | Eina_F16p16 | b
| ) |  |
| inlinestatic

Calculates the substraction of two Eina_F16p16 floating point numbers.

Parameters

  a | The first number
  b | The substracted number

Returns
  The substaction result of the two numbers `a` - `b`

static Eina_F16p16 eina_f16p16_mul | ( | Eina_F16p16 | a,
|  | Eina_F16p16 | b
| ) |  |
| inlinestatic

Calculates the multiplication of two Eina_F16p16 floating point numbers.

Parameters

  a | The first number
  b | The second number

Returns
  The mutliplication result of the two numbers `a` * `b`

Referenced by eina_matrix3_f16p16_compose().

static Eina_F16p16 eina_f16p16_scale | ( | Eina_F16p16 | a,
|  | int | b
| ) |  |
| inlinestatic

Calculates the scale multiplication of one Eina_F16p16 floating point number with an integer.

Parameters

  a | The Eina_F16p16 number
  b | The integer value

Returns
  The mutliplication result of the two numbers `a` * `b`

static Eina_F16p16 eina_f16p16_div | ( | Eina_F16p16 | a,
|  | Eina_F16p16 | b
| ) |  |
| inlinestatic

Calculates the division of two Eina_F16p16 floating point numbers.

Parameters

  a | The numerator number
  b | The denominator number

Returns
  The division result of the two numbers `a` / `b`

static Eina_F16p16 eina_f16p16_sqrt | ( | Eina_F16p16 | a | ) |
| inlinestatic

Calculates the square root of an Eina_F16p16 floating point number.

Parameters

  a | The number to calculate the square root from

Returns
  The square root result for the number `a`

static unsigned int eina_f16p16_fracc_get | ( | Eina_F16p16 | v | ) |
| inlinestatic

Get the absolute value of the integer part of and Eina_F16p16 floating point number.

Parameters

  a | The floating point number

Returns
  The positive integer part of the number `a`

static Eina_F8p24 eina_f8p24_int_from | ( | int32_t | v | ) |
| inlinestatic

Create a new Eina_F16p316 floating point number from standard 32-bit integer.

Parameters

  v | 32-bit integer value to convert

Returns
  The value converted into Eina_F8p24 format

static int32_t eina_f8p24_int_to | ( | Eina_F8p24 | v | ) |
| inlinestatic

Create a new standard 32-bit integer from Eina_F8p24 floating point number.

Parameters

  v | Eina_F8p24 value to convert

Returns
  The value converted into 32-bit integer

static Eina_F8p24 eina_f8p24_float_from | ( | float | v | ) |
| inlinestatic

Create a new Eina_F8p24 floating point number from standard float.

Parameters

  v | float value to convert

Returns
  The value converted into Eina_F8p24 format

static float eina_f8p24_float_to | ( | Eina_F8p24 | v | ) |
| inlinestatic

Create a new standard float from Eina_F8p24 floating point number.

Parameters

  v | Eina_F8p24 value to convert

Returns
  The value converted into float

static Eina_F8p24 eina_f8p24_add | ( | Eina_F8p24 | a,
|  | Eina_F8p24 | b
| ) |  |
| inlinestatic

Calculates the sum of two Eina_F8p24 floating point numbers.

Parameters

  a | The first number
  b | The second number

Returns
  The sum result of the two numbers `a` + `b`

static Eina_F8p24 eina_f8p24_sub | ( | Eina_F8p24 | a,
|  | Eina_F8p24 | b
| ) |  |
| inlinestatic

Calculates the substraction of two Eina_F8p24 floating point numbers.

Parameters

  a | The first number
  b | The substracted number

Returns
  The substaction result of the two numbers `a` - `b`

static Eina_F8p24 eina_f8p24_mul | ( | Eina_F8p24 | a,
|  | Eina_F8p24 | b
| ) |  |
| inlinestatic

Calculates the multiplication of two Eina_F8p24 floating point numbers.

Parameters

  a | The first number
  b | The second number

Returns
  The mutliplication result of the two numbers `a` * `b`

static Eina_F8p24 eina_f8p24_scale | ( | Eina_F8p24 | a,
|  | int | b
| ) |  |
| inlinestatic

Calculates the scale multiplication of one Eina_F8p24 floating point number with an integer.

Parameters

  a | The Eina_F16p16 number
  b | The integer value

Returns
  The mutliplication result of the two numbers `a` * `b`

static Eina_F8p24 eina_f8p24_div | ( | Eina_F8p24 | a,
|  | Eina_F8p24 | b
| ) |  |
| inlinestatic

Calculates the division of two Eina_F8p24 floating point numbers.

Parameters

  a | The numerator number
  b | The denominator number

Returns
  The division result of the two numbers `a` / `b`

static Eina_F8p24 eina_f8p24_sqrt | ( | Eina_F8p24 | a | ) |
| inlinestatic

Calculates the square root of an Eina_F8p24 floating point number.

Parameters

  a | The number to calculate the square root from

Returns
  The square root result for the number `a`

static unsigned int eina_f8p24_fracc_get | ( | Eina_F8p24 | v | ) |
| inlinestatic

Get the absolute value of the integer part of and Eina_F8p24 floating point number.

Parameters

  a | The floating point number

Returns
  The positive integer part of the number `a`

static Eina_F32p32 eina_f16p16_to_f32p32 | ( | Eina_F16p16 | a | ) |
| inlinestatic

Converts an Eina_F16p16 floating point number into Eina_F32p32 format.

Parameters

  a | The Eina_F16p16 floating point number

Returns
  The converted Eina_F32p32 floating point number

static Eina_F32p32 eina_f8p24_to_f32p32 | ( | Eina_F8p24 | a | ) |
| inlinestatic

Converts an Eina_F8p24 floating point number into Eina_F32p32 format.

Parameters

  a | The Eina_F8p24 floating point number

Returns
  The converted Eina_F32p32 floating point number

static Eina_F16p16 eina_f32p32_to_f16p16 | ( | Eina_F32p32 | a | ) |
| inlinestatic

Converts an Eina_F32p32 floating point number into Eina_F16p16 format.

Parameters

  a | The Eina_F32p32 floating point number

Returns
  The converted Eina_F16p16 floating point number

static Eina_F16p16 eina_f8p24_to_f16p16 | ( | Eina_F8p24 | a | ) |
| inlinestatic

Converts an Eina_F8p24 floating point number into Eina_F16p16 format.

Parameters

  a | The Eina_F8p24 floating point number

Returns
  The converted Eina_F16p16 floating point number

static Eina_F8p24 eina_f32p32_to_f8p24 | ( | Eina_F32p32 | a | ) |
| inlinestatic

Converts an Eina_F32p32 floating point number into Eina_F8p24 format.

Parameters

  a | The Eina_F32p32 floating point number

Returns
  The converted Eina_F8p16 floating point number

static Eina_F8p24 eina_f16p16_to_f8p24 | ( | Eina_F16p16 | a | ) |
| inlinestatic

Converts an Eina_F16p16 floating point number into Eina_F8p16 format.

Parameters

  a | The Eina_F16p16 floating point number

Returns
  The converted Eina_F8p16 floating point number