# 18.3 Operations for Finite Field Elements

`z1 + z2`
`z1 - z2`
`z1 * z2`
`z1 / z2`

The operators `+`, `-`, `*` and `/` evaluate to the sum, difference, product, and quotient of the two finite field elements z1 and z2, which must lie in fields of the same characteristic. For the quotient `/` z2 must of course be nonzero. The result must of course lie in a finite field of size less than or equal to 2^{16}, otherwise an error is signalled.

Either operand may also be an integer i. If i is zero it is taken as the zero in the finite field, i.e., `F.zero`, where F is a field record for the finite field in which the other operand lies. If i is positive, it is taken as i-fold sum `F.one+F.one+..+F.one`. If i is negative it is taken as the additive inverse of `-i`.

```    gap> Z(8) + Z(8)^4;
Z(2^3)^2
gap> Z(8) - 1;
Z(2^3)^3
gap> Z(8) * Z(8)^6;
Z(2)^0
gap> Z(8) / Z(8)^6;
Z(2^3)^2
gap> -Z(9);
Z(3^2)^5 ```

`z ^ i`

The powering operator `^` returns the i-th power of the element in a finite field z. i must be an integer. If the exponent i is zero, `z^i` is defined as the one in the finite field, even if z is zero; if i is positive, `z^i` is defined as the i-fold product `z*z*..*z`; finally, if i is negative, `z^i` is defined as `(1/z)^-i`. In this case z must of course be nonzero.

```    gap> Z(4)^2;
Z(2^2)^2
gap> Z(4)^3;
Z(2)^0    # is in fact 1
gap> (0*Z(4))^0;
Z(2)^0 ```

GAP 3.4.4
April 1997