Arithmetic operations
This document details the arithmetic operations supported by TFHE-rs.
Homomorphic integer types (FheUint
and FheInt
) support the following arithmetic operations:
name
symbol
type
-
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)
andct2 = FheUint8(0)
, then ct1 % ct2 returns FheUint8(63).
The following example shows how to perform arithmetic operations:
Last updated
Was this helpful?