arturo-lang/arturo

[VM/values/operators] [`dec`] Verify for Web builds

Opened this issue · 1 comments

[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)

# TODO(VM/values/operators) [`dec`] Verify for Web builds

        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)

6bae86af2461a887bc9fa60bb7c6341f1700739f

stale commented

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.