source: PSPA/madxPSPA/src/mad_math.c @ 430

Last change on this file since 430 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 333 bytes
Line 
1#include "mad_math.h"
2
3double
4fact(int i)
5{
6  int k;
7  double nfact;
8
9  if(i == 0) {
10     return(1.0);
11  } else if(i == 1) {
12     return(1.0);
13  } else if(i > 1) {
14    nfact = 1.;
15    for (k=1;k<=i;k++) {
16        nfact = nfact*k;
17    }
18     return(nfact);
19  } else if(i < 0){
20     return(-1.0);
21  } else {
22     return(-1.0);
23  }
24}
25
26
Note: See TracBrowser for help on using the repository browser.