$id = get_the_ID();
$rate_nb = get_post_meta( $id, 'wyz_business_rates_count', true );
$rate_sum = get_post_meta( $id, 'wyz_business_rates_sum', true );
function MathRaiting ( $companyRate, $n) {
$z = 1.64485;
$v_min = 1;
$v_max = 5;
$v_width = $v_max - $v_min;
$phat = ( $companyRate -$n * $v_min ) / $v_width / $n;
$rating = ( $phat + $z* $z / (2 * $n) - $z * sqrt( ($phat * (1-$phat) + $z * $z / (4 * $n) ) /$n) ) / (1 + $z * $z / $n);
return $rating * $v_width + $v_min;
}
$sumCompanyRaiting = MathRaiting($rate_sum, $rate_nb);