FACT()

FACT()

Calculates faculty

Syntax

      FACT( <nNumber> ) -> nFaculty

Arguments

<nNumber> number between 0 and 21

Returns

<nFaculty> the faculty of <nNumber>

Description

The function FACT() calculates the faculty to the integer given in <nNumber>. The faculty is defined as n! = 1*2*…*n and is often used in statistics. Note, that faculties above 21 are too big so that the function must return a -1.

Examples

      ? fact( 0 ) // --> 1
      ? fact( 1 ) // --> 1
      ? fact( 4 ) // --> 24

Tests

      fact( 0 ) == 1
      fact( 1 ) == 1
      fact( 4 ) == 24

Compliance

FACT() is compatible with CT3’s FACT().

Platforms

All

Files

Source is math.c, library is libct.

Advertisements

2 responses to “FACT()

  1. Pingback: Harbour All Functions – F | Viva Clipper !

  2. Pingback: Harbour Math Functions | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s