Go to the first, previous, next, last section, table of contents.

## Types of numbers

`0`
  rational number
  Rational numbers are implemented by arbitrary precision integers (bignum). A rational number is always expressed by a fraction of lowest terms.
`1`
  double precision floating point number (double float)
  The numbers of this type are numbers provided by the computer hardware. By default, when Asir is started, floating point numbers in a ordinary form are transformed into numbers of this type. However, they will be transformed into bigfloat numbers when the switch bigfloat is turned on (enabled) by `ctrl()` command.

      [0] 1.2;
      1.2
      [1] 1.2e-1000;
      0
      [2] ctrl("bigfloat",1);
      1
      [3] 1.2e-1000;
      1.20000000000000000513 E-1000

  A rational number shall be converted automatically into a double float number before the operation with another double float number and the result shall be computed as a double float number.
`2`
  algebraic number
  See section Algebraic numbers.
`3`
  bigfloat
  The bigfloat numbers of Asir is realized by PARI library. A bigfloat number of PARI has an arbitrary precision mantissa part. However, its exponent part admits only an integer with a single word precision. Floating point operations will be performed all in bigfloat after activating the bigfloat switch by `ctrl()` command. The default precision is about 9 digits, which can be specified by `setprec()` command.

      [0] ctrl("bigfloat",1);
      1
      [1] eval(2^(1/2));
      1.414213562373095048763788073031
      [2] setprec(100);
      9
      [3] eval(2^(1/2));
      1.41421356237309504880168872420969807856967187537694807317...

  Function `eval()` evaluates numerically its argument as far as possible. Notice that the integer given for the argument of `setprec()` does not guarantee the accuracy of the result, but it indicates the representation size of numbers with which internal operations of PARI are performed. (See section `eval`, `deval`, section `pari`.)
`4`
  complex number
  A complex number of Risa/Asir is a number with the form `a+b*@i`, where @i is the unit of imaginary number, and `a` and `b` are either a rational number, double float number or bigfloat number, respectively. The real part and the imaginary part of a complex number can be taken out by `real()` and `imag()` respectively.
`5`
  element of a small finite prime field
  Here a small finite fieid means that its characteristic is less than 2^27. At present small finite fields are used mainly for groebner basis computation, and elements in such finite fields can be extracted by taking coefficients of distributed polynomials whose coefficients are in finite fields. Such an element itself does not have any information about the field to which the element belongs, and field operations are executed by using a prime p which is set by `setmod()`.
`6`
  element of large finite prime field
  This type expresses an element of a finite prime field whose characteristic is an arbitrary prime. An object of this type is obtained by applying `simp_ff` to an integer.
`7`
  element of a finite field of characteristic 2
  This type expresses an element of a finite field of characteristic 2. Let F be a finite field of characteristic 2. If [F:GF(2)] is equal to n, then F is expressed as F=GF(2)[t]/(f(t)), where f(t) is an irreducible polynomial over GF(2) of degree n. As an element g of GF(2)[t] can be expressed by a bit string, An element g mod f in F can be expressed by two bit strings representing g and f respectively. Several methods to input an element of F are provided.
  - `@`
    `@` represents t mod f in F=GF(2)[t](f(t)). By using `@` one can input an element of F. For example `@^10+@+1` represents an element of F.
  - `ptogf2n`
    `ptogf2n` converts a univariate polynomial into an element of F.
  - `ntogf2n`
    As a bit string, a non-negative integer can be regarded as an element of F. Note that one can input a non-negative integer in decimal, hexadecimal (`0x` prefix) and binary (`0b` prefix) formats.
  - `micellaneous`
    `simp_ff` is available if one wants to convert the whole coefficients of a polynomial.
`8`
  element of a finite field of characteristic p^n A finite field of order p^n, where p is an arbitrary prime and n is a positive integer, is set by `setmod_ff` by specifying its characteristic p and an irreducible polynomial of degree n over GF(p). An element of this field is represented by a polynomial over GF(p) modulo m(x).
`9`
  element of a finite field of characteristic p^n (small order) A finite field of order p^n, where p^n must be less than 2^29 and n must be equal to 1 if p is greater or equal to 2^14@, is set by `setmod_ff` by specifying its characteristic p the extension degree n. If p is less than 2^14, each non-zero element of this field is a power of a fixed element, which is a generator of the multiplicative group of the field, and it is represented by its exponent. Otherwise, each element is represented by the redue modulo p. This specification is useful for treating both cases in a single program.

Finite fields other than small finite prime fields are set by `setmod_ff`. Elements of finite fields do not have informations about the modulus. Upon an arithmetic operation, i f one of the operands is a rational number, it is automatically converted into an element of the finite field currently set and the operation is done in the finite field.

Go to the first, previous, next, last section, table of contents.