def test_max_representable(): pytest.skip() # TODO: unknown case # a = Sfix(0, 0, 0) # assert a.max_representable() == 0 a = Sfix(0, 1, 0) assert a.max_representable() == 1 a = Sfix(0, 1, -1) assert a.max_representable() == 1.5 a = Sfix(0, 1, -2) assert a.max_representable() == 1.75 a = Sfix(0, 2, -2) assert a.max_representable() == 3.75 a = Sfix(0, -1, 0) assert a.max_representable() == 0.5 a = Sfix(0, -2, 0) assert a.max_representable() == 0.25 # TODO: unknown case # a = Sfix(0, -1, -1) # assert a.max_representable() == 0.5 ?? # FIXME: BULLSHIT, 0.25 is correct?? a = Sfix(0, -1, -2) assert a.max_representable() == 0.75 a = Sfix(0, -2, -3) assert a.max_representable() == 0.25 + 0.25 / 2
def test_repr_limits(): pytest.skip() a = Sfix(0, 0, -12) assert a.max_representable() == 0.999755859375 assert a.min_representable() == -1.0 a = Sfix(0, 1, -12) assert a.max_representable() == 1.999755859375 assert a.min_representable() == -2.0 a = Sfix(0, 2, -12) assert a.max_representable() == 3.999755859375 assert a.min_representable() == -4.0 a = Sfix(0, -1, -12) assert a.max_representable() == 0.499755859375 assert a.min_representable() == -0.5