time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

gammafn-test.js (593B)


      1 var vows = require('vows');
      2 var assert = require('assert');
      3 var suite = vows.describe('jStat.gammafn');
      4 
      5 require('../env.js');
      6 
      7 suite.addBatch({
      8   'gammafn': {
      9     'topic': function() {
     10       return jStat;
     11     },
     12 
     13     // Checked against Mathematica Gamma[a]
     14     'check gammafn': function(jStat) {
     15       var tol = 0.000001;
     16       assert.epsilon(tol, jStat.gammafn(0.00001), 99999.422794);
     17       assert.epsilon(tol, jStat.gammafn(0.2), 4.590843);
     18       assert.equal(jStat.gammafn(10), 362880);
     19       assert.equal(jStat.gammafn(171.6243769536076), Infinity);
     20     }
     21   }
     22 });
     23 
     24 suite.export(module);