fract not frac!
This commit is contained in:
parent
f84453543a
commit
6078b51561
|
@ -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.
|
## Makes v be multiple of n. Rounding to integer quantize by 1.0.
|
||||||
trunc(v / n) * n
|
trunc(v / n) * n
|
||||||
|
|
||||||
proc frac*[T: SomeFloat](v: T): T =
|
proc fract*[T: SomeFloat](v: T): T =
|
||||||
## Returns fractional part of a number.
|
## Returns fractional part of a number.
|
||||||
## 3.14 -> 0.14
|
## 3.14 -> 0.14
|
||||||
## -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"} =
|
proc fractional*[T: SomeFloat](v: T): T {.deprecated: "Use frac() insetad"} =
|
||||||
## Returns fractional part of a number.
|
## Returns fractional part of a number.
|
||||||
frac(v)
|
fract(v)
|
||||||
|
|
||||||
proc inversesqrt*[T: float32|float64](v: T): T =
|
proc inversesqrt*[T: float32|float64](v: T): T =
|
||||||
## Returns inverse square root.
|
## Returns inverse square root.
|
||||||
|
@ -730,7 +730,7 @@ genMathFn(floor)
|
||||||
genMathFn(ceil)
|
genMathFn(ceil)
|
||||||
genMathFn(abs)
|
genMathFn(abs)
|
||||||
genMathFn(trunc)
|
genMathFn(trunc)
|
||||||
genMathFn(frac)
|
genMathFn(fract)
|
||||||
genMathFn(quantize)
|
genMathFn(quantize)
|
||||||
genMathFn(toRadians)
|
genMathFn(toRadians)
|
||||||
genMathFn(toDegrees)
|
genMathFn(toDegrees)
|
||||||
|
|
|
@ -53,11 +53,11 @@ block:
|
||||||
doAssert quantize(1.23456789, 0.01) ~= 1.23
|
doAssert quantize(1.23456789, 0.01) ~= 1.23
|
||||||
doAssert quantize(-1.23456789, 0.01) ~= -1.23
|
doAssert quantize(-1.23456789, 0.01) ~= -1.23
|
||||||
|
|
||||||
doAssert frac(0.0) ~= 0.0
|
doAssert fract(0.0) ~= 0.0
|
||||||
doAssert frac(3.14) ~= 0.14
|
doAssert fract(3.14) ~= 0.14
|
||||||
doAssert frac(-3.14) ~= 0.14
|
doAssert fract(-3.14) ~= 0.14
|
||||||
doAssert frac(1.23456789) ~= 0.23456789
|
doAssert fract(1.23456789) ~= 0.23456789
|
||||||
doAssert frac(-1.23456789) ~= 0.23456789
|
doAssert fract(-1.23456789) ~= 0.23456789
|
||||||
|
|
||||||
doAssert mix(0.0, 1.0, 0.5) ~= 0.5
|
doAssert mix(0.0, 1.0, 0.5) ~= 0.5
|
||||||
doAssert mix(0.0, 10.0, 0.5) ~= 5.0
|
doAssert mix(0.0, 10.0, 0.5) ~= 5.0
|
||||||
|
|
Loading…
Reference in a new issue