Beispiel #1
0
 def test_ldexp_frexp(self, fraction, exponent):
     try:
         ibm = IBMFloat.ldexp(fraction, exponent)
     except OverflowError:
         assume(False)
     else:
         f, e = ibm.frexp()
         self.assertTrue(almost_equal(fraction * 2**exponent, f * 2**e, epsilon=EPSILON_IBM_FLOAT))
Beispiel #2
0
 def test_ldexp_frexp(self, fraction, exponent):
     try:
         ibm = IBMFloat.ldexp(fraction, exponent)
     except (OverflowError, FloatingPointError):
         raise UnsatisfiedAssumption
     else:
         f, e = ibm.frexp()
         self.assertTrue(almost_equal(fraction * 2**exponent, f * 2**e, epsilon=EPSILON_IBM_FLOAT))
Beispiel #3
0
 def test_ldexp_frexp(self, fraction, exponent):
     try:
         ibm = IBMFloat.ldexp(fraction, exponent)
     except (OverflowError, FloatingPointError):
         raise UnsatisfiedAssumption
     else:
         f, e = ibm.frexp()
         assert almost_equal(fraction * 2**exponent,
                             f * 2**e,
                             epsilon=EPSILON_IBM_FLOAT)
Beispiel #4
0
 def test_ldexp_frexp(self, fraction, exponent):
     try:
         ibm = IBMFloat.ldexp(fraction, exponent)
     except OverflowError:
         assume(False)
     else:
         f, e = ibm.frexp()
         self.assertTrue(
             almost_equal(fraction * 2**exponent,
                          f * 2**e,
                          epsilon=EPSILON_IBM_FLOAT))
Beispiel #5
0
 def test_ldexp_exponent_out_of_range_raises_value_error(
         self, fraction, exponent):
     with raises(ValueError):
         IBMFloat.ldexp(fraction, exponent)
Beispiel #6
0
 def test_ldexp_fraction_out_of_range_raises_value_error(
         self, fraction, exponent):
     assume(fraction != -1.0 and fraction != +1.0)
     with raises(ValueError):
         IBMFloat.ldexp(fraction, exponent)
Beispiel #7
0
 def test_ldexp_exponent_out_of_range_raises_value_error(self, fraction, exponent):
     with raises(ValueError):
         IBMFloat.ldexp(fraction, exponent)
Beispiel #8
0
 def test_ldexp_fraction_out_of_range_raises_value_error(self, fraction, exponent):
     assume(fraction != -1.0 and fraction != +1.0)
     with raises(ValueError):
         IBMFloat.ldexp(fraction, exponent)