Arithmetic operations
Last updated
Was this helpful?
Last updated
Was this helpful?
This document details the arithmetic operations supported by TFHE-rs.
Homomorphic integer types (FheUint
and FheInt
) support the following arithmetic operations:
-
Unary
+
Binary
-
Binary
*
Binary
/
Binary
%
Binary
Specifications for operations with zero:
Division by zero: returns modulus - 1.
Example: for FheUint8 (modulus = ), dividing by zero returns an ecryption of 255.
Remainder operator: returns the first input unchanged.
Example: if ct1 = FheUint8(63)
and ct2 = FheUint8(0)
, then ct1 % ct2 returns FheUint8(63).
The following example shows how to perform arithmetic operations:
*
*