  SELECT... Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17       Limitations on Value Representation

The factorial of a number is the product of all the numbers between 1 and the number. The factorial of 0 is 1 by definition. Here are several examples and the general formula.

 0! 1 1! 1 2! 1*2 3! 1*2*3 4! 1*2*3*4 N! N*(N-1)

Although a very simple algorithm, the values get very large very fast. In this lesson, you will run 6 applets, each of which calculates factorials but uses a different numeric type into which to store the result.

Factorial-Byte

Factorial-Short

Factorial-Int

Factorial-Long

Factorial-Float

Factorial-Double

Look carefully at the results from each of these applets. What conclusions can you draw about the size of the numbers that can be manipulated using each type of number representation? Give an example of a problem that would be appropriate for each number type.     