diff --git a/src/vmath.nim b/src/vmath.nim index ed923f1..a3a7118 100644 --- a/src/vmath.nim +++ b/src/vmath.nim @@ -406,7 +406,7 @@ proc quantize*[T: SomeFloat](v, n: T): T = ## Makes v be multiple of n. Rounding to integer quantize by 1.0. trunc(v / n) * n -proc frac*[T: SomeFloat](v: T): T = +proc fract*[T: SomeFloat](v: T): T = ## Returns fractional part of a number. ## 3.14 -> 0.14 ## -3.14 -> 0.14 @@ -415,7 +415,7 @@ proc frac*[T: SomeFloat](v: T): T = proc fractional*[T: SomeFloat](v: T): T {.deprecated: "Use frac() insetad"} = ## Returns fractional part of a number. - frac(v) + fract(v) proc inversesqrt*[T: float32|float64](v: T): T = ## Returns inverse square root. @@ -730,7 +730,7 @@ genMathFn(floor) genMathFn(ceil) genMathFn(abs) genMathFn(trunc) -genMathFn(frac) +genMathFn(fract) genMathFn(quantize) genMathFn(toRadians) genMathFn(toDegrees) diff --git a/tests/test.nim b/tests/test.nim index 4d211b5..ffba8db 100644 --- a/tests/test.nim +++ b/tests/test.nim @@ -53,11 +53,11 @@ block: doAssert quantize(1.23456789, 0.01) ~= 1.23 doAssert quantize(-1.23456789, 0.01) ~= -1.23 - doAssert frac(0.0) ~= 0.0 - doAssert frac(3.14) ~= 0.14 - doAssert frac(-3.14) ~= 0.14 - doAssert frac(1.23456789) ~= 0.23456789 - doAssert frac(-1.23456789) ~= 0.23456789 + doAssert fract(0.0) ~= 0.0 + doAssert fract(3.14) ~= 0.14 + doAssert fract(-3.14) ~= 0.14 + doAssert fract(1.23456789) ~= 0.23456789 + doAssert fract(-1.23456789) ~= 0.23456789 doAssert mix(0.0, 1.0, 0.5) ~= 0.5 doAssert mix(0.0, 10.0, 0.5) ~= 5.0