aboutsummaryrefslogtreecommitdiff
path: root/std/stdmath.sloth
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-06-26 23:42:13 -0500
committerCody <cody@codyq.dev>2023-06-26 23:42:13 -0500
commit27b7187c21f6ff4e469592a8ea5757ca6aee8577 (patch)
tree8699d8e175397da0e6b2d73814853b71c03f4a62 /std/stdmath.sloth
parenta3c5134ee7581168947df8a050c332d7cb7aa426 (diff)
parente1733fc6b3875df434a4c3060bc70286e1f08014 (diff)
downloadsloth-27b7187c21f6ff4e469592a8ea5757ca6aee8577.tar.gz
Merge branch 'master' of github.com:slothlang/slothlang
Diffstat (limited to 'std/stdmath.sloth')
-rw-r--r--std/stdmath.sloth39
1 files changed, 20 insertions, 19 deletions
diff --git a/std/stdmath.sloth b/std/stdmath.sloth
index 7ff5c82..9de73ae 100644
--- a/std/stdmath.sloth
+++ b/std/stdmath.sloth
@@ -42,28 +42,29 @@ fn fmin(x: Float, y: Float) Float {
return y;
}
-fn pow(x: Int, y: Int) Int {
- while y > 1 {
- x = x*x;
- y = y-1;
+fn pow(x: Float, y: Float) Float {
+ var power: Float = x;
+ while y > 1.0 {
+ x = power*x;
+ y = y-1.0;
}
return x;
}
-fn floor(x: Float) Float {
- return x - fabs(x % 1.0);
-}
+#fn floor(x: Float) Int {
+# return x - fabs(x % 1);
+#}
-fn ceil(x: Float) Float {
- if x < 0.0 {
- return floor(x) - 1.0;
- }
- return floor(x) + 1.0;
-}
+#fn ceil(x: Float) Int {
+# if x < 0.0 {
+# return floor(x) - 1;
+# }
+# return floor(x) + 1;
+#}
-fn round(x: Float) Float {
- if fabs(x % 1.0) >= 0.5 {
- return ceil(x);
- }
- return floor(x);
-}
+#fn round(x: Float) Float {
+# if fabs(x % 1.0) >= 0.5 {
+# return ceil(x);
+# }
+# return floor(x);
+#}