CS-220 Spring 2016 Lab 2 Factorial Limits

Factorial Definition

In mathematics, we learned about the concept of factorial numbers, such a 5! = 5 * 4 * 3 * 2 * 1 = 120.

A factorial is most easily described by a function that invokes itself in it's own definition - known as a recursive function. The recursive definition for a factorial is as follows:

factorial(1) = 1
factorial(n) = n * factorial(n-1)

Factorials are used in many applications, such as combinatorics, where the number of permutations of n objects is fact(n), in calculus where the nth derivative of x**n is factorial(n), and in many probability theory applications. Clearly factorials grow very quickly. Hence, they are good tests for limits on the size of numbers.

Starting with Signed Character numbers

Extending to Unsigned Character Numbers

Extending to larger numbers

Working with floating point factorials

Lab Report

Download and edit the following file: lab2_report.txt. Then submit your editted file on Blackboard in the Lab 2 submission area.