[MAP Logo]

Materials Algorithms Project
Program Library



Function MAP_UTIL_FACT

  1. Provenance of code.
  2. Purpose of code.
  3. Specification.
  4. Description of subroutine's operation.
  5. References.
  6. Parameter descriptions.
  7. Error indicators.
  8. Accuracy estimate.
  9. Any additional information.
  10. Example of code
  11. Auxiliary subroutines required.
  12. Keywords.
  13. Download source code.
  14. Links.

Provenance of Source Code

N. Chester,
Phase Transformations Group,
Department of Materials Science and Metallurgy,
University of Cambridge,
Cambridge, U.K.

Top | Next

Purpose

Calculates the factorial of a natural number.

Top | Next | Prev

Specification

Language:FORTRAN
Product form:Source code

DOUBLE PRECISION FUNCTION MAP_UTIL_FACT(IY)

DOUBLE PRECISION MAP_UTIL_FACT

INTEGER IY

Top | Next | Prev

Description

MAP_UTIL_FACT calculates N!, where N is a positive integer.

Top | Next | Prev

References

None supplied.

Top | Next | Prev

Parameters

Input parameters

IY - integer
IY is the integer for which the factorial is to be calculated.

Output parameters

MAP_UTIL_FACT - real
MAP_UTIL_FACT is the factorial of IY.

Top | Next | Prev

Error Indicators

None.

Top | Next | Prev

Accuracy

Limited by number of significant figures permitted by double precison. This will affect the accuracy for large IY.

Top | Next | Prev

Further Comments

None.

Top | Next | Prev

Example

1. Program text

       DOUBLE PRECISION MAP_UTIL_FACT, FAX
       INTEGER IY
       READ (5,*) IY
       FAX = MAP_UTIL_FACT(IY)
       WRITE (6,10) IY
10     FORMAT ('The factorial of ',I4,' is ')
       WRITE (6,*) FAX
       STOP
       END

2. Program data

5

3. Program results

The factorial of 5 is 
120.00

Top | Next | Prev

Auxiliary Routines

None.

Top | Next | Prev

Keywords

factorial, natural number


Top | Next | Prev

Download

Download source code

Top | Prev


MAP originated from a joint project of the National Physical Laboratory and the University of Cambridge.

MAP Website administration / map@msm.cam.ac.uk

Top | Index | MAP Homepage Valid HTML 3.2!