public function testDividesTwoDecimals7() { $a = new Decimal2('0'); $b = new Decimal2('-1'); $this->assertEquals('0.00', strval(Decimal2::div($a, $b))); }
/** * Returns the average of all the decimal numbers in the array. * * @param array $decimals The array of Decimal2 objects. * * @return Decimal2 or boolean false for an empty $decimals array. */ public static function avg(array $decimals) { if (!count($decimals)) { return false; } return Decimal2::div(Decimal2::sum($decimals), new Decimal2(count($decimals))); }