> 100!; 933262154439441526816992388562667004907159682643816214685929638952175999932299\ 156089414639761565182862536979208272237582511852109168640000000000000000000000\ 00All 158 digits of 100! are returned, and the answer is exact. (The backslashes mean that the line breaks have been artificially introduced in order to make the answer fit on screen, and they are not part of the answer.)
Likewise, Maple fractions have numerator and denominator of arbitrary precision, so in theory any given rational number can be exactly represented by Maple (subject only to the size of your computer's memory!).
Most results in Maple are exact. Even irrational numbers are returned in terms of their definition, and not as truncated decimal expansions:
> arctan(1); 1/4 Pi > sqrt(2); 1/2 2Sometimes you may want to know the answer in floating-point form. The function evalf() (think: "evaluate as floating point") achieves this:
> sqrt(2); 1/2 2 > evalf("); 1.414213562
The precision of the answer (number of significant digits) is 10 by default, but you can request a floating point approximation of any precision by giving a second argument to evalf():
> sqrt(2); 1/2 2 > evalf(", 30); 1.41421356237309504880168872421As an extreme example, try evalf(Pi, 5000);.
The built-in variable Digits holds the default precision for floating point approximations, initially 10. You can change the default precision to 40 by assigning Digits := 40 for example.
Maple often gives an answer in partly unevaluated form, either because certain of the quantities are variables whose value is not known, or because Maple couldn't find a closed form answer. On occasion, you may want to ask Maple to evaluate such an expression and give a numeric approximation. evalf() can do this too. For example:
> int( exp(x^x), x=0..1); 1 / | x | exp(x ) dx | / 0 > evalf("); 2.197544438Maple had a hard time simplifying the integral, so it returned a symbolic expression--the unevaluated integral. evalf() uses one of the various techniques of numerical integration, and returns the result.
evalf() does the best it can, however if there are symbols in the expression whose value is unknown or non-numeric, then the result will still depend on these symbols:
> evalf(Pi + cos(t)); 3.141592654 + cos(t)