Yes, I think so as well. The comment on the following proc:
# This doesn't work when a = b
proc multiplication(a: var BigInt, b, c: BigInt)
Run
is a pointer, I guess. It is called by:
`*` *(a, b: BigInt): BigInt =
result = zero
multiplication(
It could be a bug in `bigints`. My stacktrace was:
test.nim(24)test
nim/pure/collections/sequtils.nim(727) product
nimble/pkgs/bigints-0.4.3/bigints.nim(395) multiplication
Run
yeah, something is broken :(
Ok thanks. But that sounds weird to use initBigInt() since it's already a
seq[BigInt], isn't it?
Changing the foldl to:
foldl(data, initBigInt(a) * initBigInt(b), initBigInt(1))
Run
helps.
Could be a problem with bounds checking, it works if compiled with
`--boundChecks:off`.
Hi all,
I'm pretty new to the language. I tried the following snippet:
import sequtils
import sugar
import bigints
const
n = 15
proc product[T](data: seq[T]) {.thread.} =
echo "data=" , data
echo foldl(data, a * b)
proc sum[