# lv_nanovg_math.h (/api/draw/nanovg/lv_nanovg_math_h)



<ApiSummary functions="3" macros="14" />

Functions [#functions]

<ApiMember kind="function" name="nvg_math_is_zero" file="draw/nanovg/lv_nanovg_math.h" line="59" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L59">
  nvg_math_is_zero [#nvg_math_is_zero]

  Check if the floating point number is zero

  ```c title=" " lineNumbers=1
  static bool nvg_math_is_zero(float a)
  ```

  <span className="sr-only">
    Parameters
  </span>

  | Name | Type    | Description         |
  | ---- | ------- | ------------------- |
  | `a`  | `float` | the number to check |

  **Returns:** <ApiLink name="bool" /> — true if the number is zero, false otherwise
</ApiMember>

<ApiMember kind="function" name="nvg_math_is_equal" file="draw/nanovg/lv_nanovg_math.h" line="70" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L70">
  nvg_math_is_equal [#nvg_math_is_equal]

  Check if two floating point numbers are equal

  ```c title=" " lineNumbers=1
  static bool nvg_math_is_equal(float a, float b)
  ```

  <span className="sr-only">
    Parameters
  </span>

  | Name | Type    | Description       |
  | ---- | ------- | ----------------- |
  | `a`  | `float` | the first number  |
  | `b`  | `float` | the second number |

  **Returns:** <ApiLink name="bool" /> — true if the numbers are equal, false otherwise
</ApiMember>

<ApiMember kind="function" name="nvg_math_inv_sqrtf" file="draw/nanovg/lv_nanovg_math.h" line="80" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L80">
  nvg_math_inv_sqrtf [#nvg_math_inv_sqrtf]

  Calculate the inverse square root (1/sqrt(x))

  ```c title=" " lineNumbers=1
  static float nvg_math_inv_sqrtf(float number)
  ```

  <span className="sr-only">
    Parameters
  </span>

  | Name     | Type    | Description      |
  | -------- | ------- | ---------------- |
  | `number` | `float` | the input number |

  **Returns:** `float` — the inverse square root
</ApiMember>

Macros [#macros]

<ApiMember kind="macro" name="NVG_MATH_PI" file="draw/nanovg/lv_nanovg_math.h" line="29" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L29">
  NVG_MATH_PI [#nvg_math_pi]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_PI 3.14159265358979323846f
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_HALF_PI" file="draw/nanovg/lv_nanovg_math.h" line="30" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L30">
  NVG_MATH_HALF_PI [#nvg_math_half_pi]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_HALF_PI 1.57079632679489661923f
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_TWO_PI" file="draw/nanovg/lv_nanovg_math.h" line="31" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L31">
  NVG_MATH_TWO_PI [#nvg_math_two_pi]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_TWO_PI 6.28318530717958647692f
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_DEG_TO_RAD" file="draw/nanovg/lv_nanovg_math.h" line="32" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L32">
  NVG_DEG_TO_RAD [#nvg_deg_to_rad]

  ```c title=" " lineNumbers=1
  #define NVG_DEG_TO_RAD 0.017453292519943295769236907684886f
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_RAD_TO_DEG" file="draw/nanovg/lv_nanovg_math.h" line="33" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L33">
  NVG_RAD_TO_DEG [#nvg_rad_to_deg]

  ```c title=" " lineNumbers=1
  #define NVG_RAD_TO_DEG 57.295779513082320876798154814105f
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_TANF" file="draw/nanovg/lv_nanovg_math.h" line="35" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L35">
  NVG_MATH_TANF [#nvg_math_tanf]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_TANF(x) \
      tanf(x)
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_SINF" file="draw/nanovg/lv_nanovg_math.h" line="36" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L36">
  NVG_MATH_SINF [#nvg_math_sinf]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_SINF(x) \
      sinf(x)
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_COSF" file="draw/nanovg/lv_nanovg_math.h" line="37" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L37">
  NVG_MATH_COSF [#nvg_math_cosf]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_COSF(x) \
      cosf(x)
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_ASINF" file="draw/nanovg/lv_nanovg_math.h" line="38" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L38">
  NVG_MATH_ASINF [#nvg_math_asinf]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_ASINF(x) \
      asinf(x)
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_ACOSF" file="draw/nanovg/lv_nanovg_math.h" line="39" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L39">
  NVG_MATH_ACOSF [#nvg_math_acosf]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_ACOSF(x) \
      acosf(x)
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_FABSF" file="draw/nanovg/lv_nanovg_math.h" line="40" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L40">
  NVG_MATH_FABSF [#nvg_math_fabsf]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_FABSF(x) \
      fabsf(x)
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_SQRTF" file="draw/nanovg/lv_nanovg_math.h" line="41" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L41">
  NVG_MATH_SQRTF [#nvg_math_sqrtf]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_SQRTF(x) \
      sqrtf(x)
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_RADIANS" file="draw/nanovg/lv_nanovg_math.h" line="43" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L43">
  NVG_MATH_RADIANS [#nvg_math_radians]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_RADIANS(deg) \
      ((deg) * NVG_DEG_TO_RAD)
  ```
</ApiMember>

<ApiMember kind="macro" name="NVG_MATH_DEGREES" file="draw/nanovg/lv_nanovg_math.h" line="44" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/draw/nanovg/lv_nanovg_math.h#L44">
  NVG_MATH_DEGREES [#nvg_math_degrees]

  ```c title=" " lineNumbers=1
  #define NVG_MATH_DEGREES(rad) \
      ((rad) * NVG_RAD_TO_DEG)
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;math.h&#x22;, &#x22;stdbool.h&#x22;, &#x22;float.h&#x22;]" transitiveIncludes="[&#x22;lv_conf_kconfig.h&#x22;]" />
