From 6078b5156185c6fc518289f922e8602e0835289b Mon Sep 17 00:00:00 2001 From: treeform Date: Sun, 5 Mar 2023 11:41:13 -0800 Subject: [PATCH] fract not frac! --- src/vmath.nim | 6 +++--- tests/test.nim | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) 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