TAU :: 6.28318330f;
// Simple taylor series approximation of sin(t)
-sin :: proc (t: f32) -> f32 {
+sin :: proc (t_: f32) -> f32 {
+ t := t_;
while t >= PI do t -= TAU;
while t <= -PI do t += TAU;
}
// Simple taylor series approximation of cos(t)
-cos :: proc (t: f32) -> f32 {
+cos :: proc (t_: f32) -> f32 {
+ t := t_;
while t >= PI do t -= TAU;
while t <= -PI do t += TAU;
return -x;
}
abs :: proc { abs_i32, abs_i64, abs_f32, abs_f64 }
+
+pow_int :: proc (base: $T, p: i32) -> T {
+ if base == 0 && p == 0 do return 1;
+ elseif p == 0 do return 1;
+ a := 1;
+ b := p;
+ c := base;
+ while b > 0 {
+ if b % 2 == 1 do a *= c;
+ b = b >> 1;
+ c *= c;
+ }
+ return a;
+}
+
+pow_float :: proc (base: $T, p: f32) -> T {
+ if base == 0 && p == 0 do return 1;
+ elseif p == 0 do return 1;
+
+}
+
+pow :: proc { pow_int, pow_float }
+
+ln :: proc (a: f32) -> f32 {
+
+}
+
+log :: proc (a: $T, b: $R) ->T {
+
+}