Beispiel #1
0
 /**
  * This method tests the "toDouble" method.
  *
  * @dataProvider data_toDouble
  */
 public function test_toDouble(array $provided, array $expected)
 {
     $p0 = IInt32\Module::toDouble(IInt32\Type::box($provided[0]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IDouble\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
Beispiel #2
0
 /**
  * This method returns the value as a IDouble. Note: Using this method may result in
  * lost of precision.
  *
  * @access public
  * @static
  * @param IRatio\Type $x                                    the object to be converted
  * @return IDouble\Type                                     the value as a IDouble
  */
 public static function toDouble(IRatio\Type $x) : IDouble\Type
 {
     return IRatio\Module::isInteger($x)->unbox() ? IInt32\Module::toDouble($x->numerator()) : IDouble\Module::divide(IInt32\Module::toDouble($x->numerator()), IInt32\Module::toDouble($x->denominator()));
 }