number fields

Number fields

All variables and functions are interpreted in a number field which can be defined within the
question environment by the \field{...} command. It can take one of the following values:

number field Description
real real numbers (i.e. decimal numbers); this is the default value if the \field{number field} command is omitted
integer integer numbers
rational rational numbers
complex complex numbers with real numbers as real and imaginary parts
complex-rational complex numbers with rational numbers as real and imaginary parts
    \field{...} %  set for this question and all their answers

Precision of real numbers

If the number field is chosen to be real or complex, there are two issues of precision:
the display-precision of the numbers/functions and the corrector-precision.

For more information about precision see also the two examples in WebMiau:

Important conditions:

  • Corrector precision must be less or equal to displayprecision.
  • For all functions rounded to a precision $n$ the xorrector precision must be less or equal to n.

Display precision

For displaying variables defined by \number,\randdouble, or \randrat one uses the
command \displayprecision{\} which defines the number of digits
used for displaying.
If not specified, then the generic problem will use the default value of 2.

When a number was created by the \function-command (or \substitute or \derivative)
using the calculate option, the precision defined with the above command will be
ignored. This is because computations should not be rounded while not visible to the user.
In case you do want to display the calculated value then set the precision within the command,


Again this value should be $$\geq$$ corrector precision.

Corrector precision

The precision used for correction depends on the type of the answer.

For type input.number, one uses the command
\correctorprecision[correctorOption]{number of decimal digits}
similar to \displayprecision. For details see the wiki-page about rounding

If \correctorprecision is not specified, then the generic problem will use the default
value of 2.

For answers of type input.function the precision is given as an optional argument in the
command that specifies how to check the given answer for correctness.
See Corrector commands for input.function.