EvalAdd does not add in some cases

Hi @lujoho

Please keep in mind that scaleModSize and firstModSize are two related parameters. firstModSize is used for decryption. If the multiplicative depth is set exactly to the depth of circuit, then at the time of decryption you will be working with a single modulus of firsModSize. Therefore, your message cannot be larger (in bits) than firstModSize - scaleModSize (roughly). When you increase scaleModSize (closer to firstModulusSize), you decrease the room for the message. Most likely, you are getting into this issue (it is a question of using CKKS correctly rather than a bug in OpenFHE).

There is an easy way to confirm this. Just increase the multiplicative depth by 1 and see if the issue goes away. If you do this, the message “budget” in bits will increase to firstModSize, i.e., scaleModSize + firstModSize - scaleModSize.

Everything I described here is expected by CKKS design.