MCPcopy Index your code
hub / github.com/python/cpython / precfloat

Class precfloat

Lib/test/test_descr.py:2931–2936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2929 self.assertEqual(int(a), -1) # self.assertTrue PyNumber_Long() copies the sign bit
2930
2931 class precfloat(float):
2932 __slots__ = ['prec']
2933 def __init__(self, value=0.0, prec=12):
2934 self.prec = int(prec)
2935 def __repr__(self):
2936 return "%.*g" % (self.prec, self)
2937 self.assertEqual(repr(precfloat(1.1)), "1.1")
2938 a = precfloat(12345)
2939 self.assertEqual(a, 12345.0)

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…