Problem with Modulo Command

Sometimes, Snap can't successfully solve a modulo problem, spitting out a wrong number. This problem usually appears when trying to solve equations with very high numbers. Because of this issue, some decoding algorithms don't work properly, making it impssoble to decode your input.

Welcome to :sn:. Could you share an example project?

As a simpler example, running this block returns 0.

untitled script pic

I assume this is because of issues with floating point precision. Floating point numbers have a maximum precision in bits - think the binary version of significant digits. If your number requires more digits to represent than that, it can't be represented exactly.

Fortunately, Snap! has a library that allows you to use integers with unbounded precision. You can find it by going to the 'File' menu, and clicking 'Libraries'.

The infinite-precision library is one solution, as @rdococ says; but in cryptographic algorithms the usual thing is to keep doing mod on intermediate steps so the numbers never get that big.