code: public static function GAMMADIST($value, $a, $b, $cumulative)
      {
          $value = Functions::flattenSingleValue($value);
          $a = Functions::flattenSingleValue($a);
          $b = Functions::flattenSingleValue($b);
  
          if ((is_numeric($value)) && (is_numeric($a)) && (is_numeric($b))) {
              if (($value < 0) || ($a <= 0) || ($b <= 0)) {
                  return Functions::NAN();
              }
              if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
                  if ($cumulative) {
                      return self::incompleteGamma($a, $value / $b) / self::gamma($a);
                  }
  
                  return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a - 1) * exp(0 - ($value / $b));
              }
          }
  
          return Functions::VALUE();
      }
docs: GAMMADIST.
  
  Returns the gamma distribution.
  
  @param float $value Value at which you want to evaluate the distribution
  @param float $a Parameter to the distribution
  @param float $b Parameter to the distribution
  @param bool $cumulative
  
  @return float