Compare commits
No commits in common. "main" and "v0.0.5" have entirely different histories.
16
math.go
16
math.go
@ -1,8 +1,6 @@
|
||||
package gmath
|
||||
|
||||
import (
|
||||
"math"
|
||||
)
|
||||
import "math"
|
||||
|
||||
func Pow[N Number](x, y N) N {
|
||||
return N(math.Pow(float64(x), float64(y)))
|
||||
@ -11,15 +9,3 @@ func Pow[N Number](x, y N) N {
|
||||
func Abs[N Number](v N) N {
|
||||
return N(math.Abs(float64(v)))
|
||||
}
|
||||
|
||||
func Mod[N Number](a, b N) N {
|
||||
return N(math.Mod(float64(a), float64(b)))
|
||||
}
|
||||
|
||||
func ModPositive[N Number](a, b N) N {
|
||||
m := Mod(a, b)
|
||||
if m >= 0 {
|
||||
return m
|
||||
}
|
||||
return m + b
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user