Closed nbarlowATI closed 6 years ago
(Finding this out now is an illustration of inadequate tests - the HElib subtraction test only looked at positive numbers - need to add more corner cases!)
I think a reasonable solution (that seems to work on the extensive set of new tests!) is:
Can we close this?
context-helib gives the wrong answer when dealing with negative numbers. e.g. with inputs and outputs
int8_t
, if we do: 3 ADD -4 we get the answer 0 instead of -1 3 MULTIPLY -4 we get -11 instead of -12 5 NEGATE we get -4 instead of -5i.e. the answer is always (correct_answer+1)
I don't think this is actually a problem with HElib, but just a consequence of HElib returning the decrypted plaintext as a long modulo p followed by us casting this into a signed integer..