code: public static function BINOMDIST($value, $trials, $probability, $cumulative)
      {
          $value = floor(Functions::flattenSingleValue($value));
          $trials = floor(Functions::flattenSingleValue($trials));
          $probability = Functions::flattenSingleValue($probability);
  
          if ((is_numeric($value)) && (is_numeric($trials)) && (is_numeric($probability))) {
              if (($value < 0) || ($value > $trials)) {
                  return Functions::NAN();
              }
              if (($probability < 0) || ($probability > 1)) {
                  return Functions::NAN();
              }
              if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
                  if ($cumulative) {
                      $summer = 0;
                      for ($i = 0; $i <= $value; ++$i) {
                          $summer += MathTrig::COMBIN($trials, $i) * pow($probability, $i) * pow(1 - $probability, $trials - $i);
                      }
  
                      return $summer;
                  }
  
                  return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value);
              }
          }
  
          return Functions::VALUE();
      }
docs: BINOMDIST.
  
  Returns the individual term binomial distribution probability. Use BINOMDIST in problems with
  a fixed number of tests or trials, when the outcomes of any trial are only success or failure,
  when trials are independent, and when the probability of success is constant throughout the
  experiment. For example, BINOMDIST can calculate the probability that two of the next three
  babies born are male.
  
  @param float $value Number of successes in trials
  @param float $trials Number of trials
  @param float $probability Probability of success on each trial
  @param bool $cumulative
  
  @return float
  
  @todo    Cumulative distribution function