/** * This method returns the value as a IDouble. Note: Using this method may result in * lost of precision. * * @access public * @static * @param ITrit\Type $x the object to be converted * @return IDouble\Type the value as a IDouble */ public static function toDouble(ITrit\Type $x) : IDouble\Type { return IDouble\Type::make($x->unbox()); }
/** * This method returns the hyperbolic tangent of this object's value. * * @access public * @static * @param IReal\Type $x the operand * @return IDouble\Type the result */ public static function tanh(IReal\Type $x) : IDouble\Type { return IDouble\Type::box(tanh($x->unbox())); }
/** * This method tests the "isNegative" method. * * @dataProvider data_isNegative */ public function test_isNegative(array $provided, array $expected) { $p0 = IDouble\Module::isNegative(IDouble\Type::box($provided[0])); $e0 = $expected[0]; $this->assertInstanceOf('\\Saber\\Data\\IBool\\Type', $p0); $this->assertSame($e0, $p0->unbox()); }
/** * This method returns whether the operand is a negative number. * * @access public * @static * @param IDouble\Type $x the object to be evaluated * @return IBool\Type whether the operand is a negative * number */ public static function isNegative(IDouble\Type $x) : IBool\Type { return IBool\Type::box($x->unbox() < 0.0); }
/** * This method tests the "toString" method. * * @dataProvider data_toString */ public function test_toString(array $provided, array $expected) { $p0 = IDouble\Type::box($provided[0])->toString(); $e0 = $expected[0]; $this->assertInstanceOf('\\Saber\\Data\\IString\\Type', $p0); $this->assertSame($e0, $p0->unbox()); }
/** * This method returns the sum of all items in the list. * * @access public * @static * @param ISeq\Type $xs the sequence to be processed * @return IDouble\Type the result */ public static function sum(ISeq\Type $xs) : IDouble\Type { return $xs->foldLeft(function (IDouble\Type $c, INumber\Type $x) { return IDouble\Module::add($c, $x->toDouble()); }, IDouble\Type::zero()); }