Przeglądaj źródła

core: add fpow()

Daniele Bartolini 10 miesięcy temu
rodzic
commit
eba3cbfee1
2 zmienionych plików z 8 dodań i 0 usunięć
  1. 3 0
      src/core/math/math.h
  2. 5 0
      src/core/math/math.inl

+ 3 - 0
src/core/math/math.h

@@ -44,6 +44,9 @@ f32 ftan(f32 a);
 /// Returns the nonnegative square root of @a a.
 /// Returns the nonnegative square root of @a a.
 f32 fsqrt(f32 a);
 f32 fsqrt(f32 a);
 
 
+/// Returns the value of @a x raised to the power of @a y.
+f32 fpow(f32 x, f32 y);
+
 /// Returns @a deg in radians.
 /// Returns @a deg in radians.
 f32 frad(f32 deg);
 f32 frad(f32 deg);
 
 

+ 5 - 0
src/core/math/math.inl

@@ -59,6 +59,11 @@ inline f32 fsqrt(f32 a)
 	return sqrtf(a);
 	return sqrtf(a);
 }
 }
 
 
+inline f32 fpow(f32 x, f32 y)
+{
+	return powf(x, y);
+}
+
 inline f32 frad(f32 deg)
 inline f32 frad(f32 deg)
 {
 {
 	return deg * PI / 180.0f;
 	return deg * PI / 180.0f;