of Color || Color : x.l -= y.l
of Quantity || Integer : x.q -= y.i
of Quantity || BigInteger : (when defined(GMP): x.q -= y.bi)
of Quantity || Floating : x.q -= y.f
of Quantity || Rational : x.q -= y.rat
of Quantity || Quantity : x.q -= y.q
else:
objectOperationOrNothing("sub", SubM, inplace=true)
# TODO(VM/values/operators) [`dec`] Verify for Web builds
# we should also check whether big integers work too!
# (the same applies to its in-place equivalent)
# labels: unit-test, web, :integer
proc dec*(x: Value): Value =
## decrement given value and return the result
case x.kind:
of Integer:
if x.iKind==NormalInteger: return normalIntegerDec(x.i)
else: (when BignumSupport: return newInteger(x.bi-toBig(1)))
of Floating: return newFloating(x.f-1.0)
of Rational: return newRational(x.rat-1)
of Complex: return newComplex(x.z-1.0)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
[VM/values/operators] [
dec
] Verify for Web builds we should also check whether big integers work too! (the same applies to its in-place equivalent)https://github.com/arturo-lang/arturo/blob/04e57a1a8d6bcaf8fdb4003e0893ca35cc4ee90e/src/vm/values/operators.nim#L673
6bae86af2461a887bc9fa60bb7c6341f1700739f