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))
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))
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)
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))
def test_ldexp_exponent_out_of_range_raises_value_error( self, fraction, exponent): with raises(ValueError): IBMFloat.ldexp(fraction, exponent)
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)
def test_ldexp_exponent_out_of_range_raises_value_error(self, fraction, exponent): with raises(ValueError): IBMFloat.ldexp(fraction, exponent)
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)