FLINT3.7.0-dev

CA_PRINT_N, CA_PRINT_DIGITS, CA_PRINT_REPR, CA_PRINT_FIELD, CA_PRINT_DEFAULT, CA_PRINT_DEBUG

Synopsis#include <flint/ca.h>
CA_PRINT_Nsource
CA_PRINT_DIGITSsource
CA_PRINT_REPRsource
CA_PRINT_FIELDsource
CA_PRINT_DEFAULTsource
CA_PRINT_DEBUGsource

Printing flags. CA_PRINT_N prints a decimal approximation, correct to within one unit in the last digit, with six digits or with d digits if d \cdot CA_PRINT_DIGITS is added to the flags. CA_PRINT_REPR prints the symbolic representation, giving local names a, b, ... to the extension numbers involved; together with CA_PRINT_N, field elements are printed as decimal {symbolic} and extension numbers as decimal [definition]. CA_PRINT_FIELD also prints the field of each element with its ideal of relations, such as QQ(a,b)/<a^2-2>. CA_PRINT_DEFAULT is CA_PRINT_N | CA_PRINT_REPR and CA_PRINT_DEBUG is CA_PRINT_N | CA_PRINT_REPR | CA_PRINT_FIELD.

The decimal approximation is computed at a fixed precision of about 3.33 d + 64 bits, without the adaptive refinement of ca_get_decimal_str, and only correct digits are printed. A number much smaller than the numbers it is computed from is therefore printed with fewer digits or as 0eN: Ramanujan's constant e^{\pi \sqrt{163}} - 640320^3 - 744 \approx -7.5 \cdot 10^{-13} prints as 0e-5 {a-262537412640768744 where ...}. Use ca_get_decimal_str for a guaranteed number of significant digits.

When the enclosure is indeterminate at this precision (for example because the enclosure of a denominator contains zero), its real and imaginary parts are printed as [+/- inf], even for a well-defined real number; there is no recomputation at a higher precision. For example, the reciprocal of Ramanujan's constant prints as [+/- inf] + [+/- inf]*I {(1)/(a-262537412640768744) where ...}, while ca_get_decimal_str gives -1.333462408e+12.

For example, -7, 2/3, (\sqrt{3}+5)/2 and \sqrt{2} (\log(\pi) + \pi i) print as follows.

# CA_PRINT_DEFAULT
-7
0.666667 {2/3}
3.36603 {(a+5)/2 where a = 1.73205 [a^2-3=0]}
1.61889 + 4.44288*I {a*c+b*c*d where a = 1.14473 [Log(3.14159 {b})], b = 3.14159 [Pi], c = 1.41421 [c^2-2=0], d = I [d^2+1=0]}

# CA_PRINT_N
-7
0.666667
3.36603
1.61889 + 4.44288*I

# CA_PRINT_N | (CA_PRINT_DIGITS * 20)
-7
0.66666666666666666667
3.3660254037844386468
1.6188925298220266685 + 4.4428829381583662470*I

# CA_PRINT_REPR
-7
2/3
(a+5)/2 where a = [a^2-3=0]
a*c+b*c*d where a = Log(b), b = Pi, c = [c^2-2=0], d = [d^2+1=0]

# CA_PRINT_DEBUG
-7
0.666667 {2/3  in  QQ}
3.36603 {(a+5)/2  in  QQ(a)/<a^2-3> where a = 1.73205 [a^2-3=0]}
1.61889 + 4.44288*I {a*c+b*c*d  in  QQ(a,b,c,d)/<c^2-2, d^2+1> where a = 1.14473 [Log(3.14159 {b  in  QQ(b)})], b = 3.14159 [Pi], c = 1.41421 [c^2-2=0], d = I [d^2+1=0]}

A decimal approximation is computed when it is printed, which can be expensive, and may refine the enclosures cached in the context, which can affect later computations.

Cite this page

The FLINT team, “CA_PRINT_N, CA_PRINT_DIGITS, CA_PRINT_REPR, CA_PRINT_FIELD, CA_PRINT_DEFAULT, CA_PRINT_DEBUG (ca.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ca/CA_PRINT_N.html (generated 2026-10-20).