src/Alg/Math/Average.php
public static function arithmetic( $values, $accuracy = NULL )
	{
		Deprecation::getInstance()
			->setErrorVersion( '0.8.5' )
			->setExceptionVersion( '0.9' )
			->message( sprintf(
				'Please use %s (%s) instead',
				'public library "CeusMedia/Math"',
			 	'https://packagist.org/packages/ceus-media/math'
			) );
		$sum	= 0;
		foreach( $values as $value )
			$sum	+= $value;
		$result	= $sum / count( $values );
		if( $accuracy >= 0 )
			$result	= round( $result, $accuracy );
		return $result;
	}
public static function arithmetic( $values, $accuracy = NULL )
	{
		Deprecation::getInstance()
			->setErrorVersion( '0.8.5' )
			->setExceptionVersion( '0.9' )
			->message( sprintf(
				'Please use %s (%s) instead',
				'public library "CeusMedia/Math"',
			 	'https://packagist.org/packages/ceus-media/math'
			) );
		$sum	= 0;
		foreach( $values as $value )
			$sum	+= $value;
		$result	= $sum / count( $values );
		if( $accuracy >= 0 )
			$result	= round( $result, $accuracy );
		return $result;
	}
public static function arithmetic ( $ values , $ accuracy = NULL ) { Deprecation :: getInstance ( ) -> setErrorVersion ( '0.8.5' ) -> setExceptionVersion ( '0.9' ) -> message ( sprintf ( 'Please use %s (%s) instead' , 'public library "CeusMedia/Math"' , 'https://packagist.org/packages/ceus-media/math' ) ) ; $ sum = 0 ; foreach ( $ values as $ value ) $ sum += $ value ; $ result = $ sum / count ( $ values ) ; if ( $ accuracy >= 0 ) $ result = round ( $ result , $ accuracy ) ; return $ result ; }
Calculates artithmetic Average.
@access		public
@static
@param		array		$values			Array of Values.
@param		int			$accuracy		Accuracy of Result
@return		float
Calculates artithmetic Average .