GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
xt_factorial(3) FreeBSD Library Functions Manual xt_factorial(3)

#include <inttypes.h>
#include <xtend/math.h>
-lxtend

uint64_t    xt_factorial(unsigned n)

n   Integer in the range [0,20] (inclusive) for which n! is returned.

Instantaneous factorial for n in [0,20] using a lookup table.

Note that 21! is beyond the range of uint64_t, so programs that need it should either use a multiple precision library or rearrange the computations to avoid repeated multiplication leading to overflow. n_choose_k(3) uses the latter approach to avoid computing whole factorials before finally dividing.

n! if n is an element of [0,20], 0 otherwise

#include <inttypes.h>
#include <xtend/math.h>
printf("20! = %" PRIu64 "n", factorial(20));

Environment


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.