projects
/
onyx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bb9df1b
)
added: `math.fmod`
author
Brendan Hansen
<brendan.f.hansen@gmail.com>
Thu, 30 Mar 2023 23:10:30 +0000
(18:10 -0500)
committer
Brendan Hansen
<brendan.f.hansen@gmail.com>
Thu, 30 Mar 2023 23:10:30 +0000
(18:10 -0500)
core/math/math.onyx
patch
|
blob
|
history
diff --git
a/core/math/math.onyx
b/core/math/math.onyx
index 43740c2803dbee37fbd73001861bff3967339855..1bb168ed7bea066fb0cbab9c49e17ec7c335b97e 100644
(file)
--- a/
core/math/math.onyx
+++ b/
core/math/math.onyx
@@
-249,6
+249,18
@@
ilog2 :: (a: u64) -> u64 {
}
+fmod :: #match #local {}
+
+#overload
+fmod :: (x, y: f64) -> f64 {
+ return x - trunc(x / y) * y;
+}
+
+#overload
+fmod :: (x, y: f32) -> f32 {
+ return x - trunc(x / y) * y;
+}
+
// These function are overloaded in order to use the builtin WASM intrinsics for the
// operation first, and then default to a polymorphic function that works on any type.