Blender  V2.93
Functions
math_base.c File Reference
#include "BLI_math.h"
#include "BLI_strict_flags.h"

Go to the source code of this file.

Functions

int pow_i (int base, int exp)
 
double double_round (double x, int ndigits)
 
float floor_power_of_10 (float f)
 
float ceil_power_of_10 (float f)
 

Function Documentation

◆ ceil_power_of_10()

float ceil_power_of_10 ( float  f)

Ceiling to the nearest power of 10, e.g.:

  • 15.0 -> 100.0
  • 0.015 -> 0.1
  • 1.0 -> 1.0
Parameters
fValue to ceiling, must be over 0.0.
Note
If we wanted to support signed values we could if this becomes necessary.

Definition at line 109 of file math_base.c.

References BLI_assert, floorf, and powf.

Referenced by cursor_plane_draw(), and TEST().

◆ double_round()

double double_round ( double  x,
int  ndigits 
)

◆ floor_power_of_10()

float floor_power_of_10 ( float  f)

Floor to the nearest power of 10, e.g.:

  • 15.0 -> 10.0
  • 0.015 -> 0.01
  • 1.0 -> 1.0
Parameters
fValue to floor, must be over 0.0.
Note
If we wanted to support signed values we could if this becomes necessary.

Definition at line 91 of file math_base.c.

References BLI_assert, ceilf, and powf.

Referenced by TEST().

◆ pow_i()

int pow_i ( int  base,
int  exp 
)

Definition at line 30 of file math_base.c.

References BLI_assert, KDL::exp(), and result.

Referenced by multires_create_grids_in_unsubdivided_base_mesh(), and paint_proj_new_stroke().