Java examples for java.lang:Math Value
Returns gamma value for a double in.
//package com.java2s; public class Main { /**//from w w w .j a v a 2 s.co m * Returns gamma value for a double in. */ public static double gammaFunction(double in) { if (in == 1.0) { return 1.0; } if (in == 0.5) { return Math.sqrt(Math.PI); } return (in - 1) * gammaFunction(in - 1); } }