You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Test with various values that require full quad precision
18
+
test_values= [
19
+
QuadPrecision("0.417022004702574000667425480060047"), # Random value
20
+
QuadPrecision("1.23456789012345678901234567890123456789"), # Many digits
21
+
numpy_quaddtype.pi, # Mathematical constant
22
+
numpy_quaddtype.e,
23
+
QuadPrecision("1e-100"), # Very small
24
+
QuadPrecision("1e100"), # Very large
25
+
QuadPrecision("3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233"), # very precise pi
26
+
]
27
+
28
+
fororiginalintest_values:
29
+
string_repr=str(original)
30
+
reconstructed=QuadPrecision(string_repr)
31
+
32
+
# Values should be exactly equal (bit-for-bit identical)
33
+
assertreconstructed==original, (
34
+
f"Round-trip failed for {repr(original)}:\n"
35
+
f" Original: {repr(original)}\n"
36
+
f" String: {string_repr}\n"
37
+
f" Reconstructed: {repr(reconstructed)}"
38
+
)
39
+
40
+
# Also verify repr() preserves value
41
+
repr_str=repr(original)
42
+
# Extract the string value from repr format: QuadPrecision('value', backend='...')
0 commit comments