added `product` function in Num module
drkameleon yaniszaf@gmail.com
Thu, 21 Jan 2021 18:30:09 +0100
1 files changed,
16 insertions(+),
0 deletions(-)
jump to
M
minpkg/lib/min_num.nim
→
minpkg/lib/min_num.nim
@@ -135,4 +135,20 @@ i.push c.int.newVal
else: i.push c.newVal + def.symbol("product") do (i: In): + var s: MinValue + i.reqQuotationOfNumbers s + var c = 1.float + var isInt = true + for n in s.qVal: + if n.isFloat: + isInt = false + c = c * n.floatVal + else: + c = c * n.intVal.float + if isInt: + i.push c.int.newVal + else: + i.push c.newVal + def.finalize("num")