Skip to content

Commit a986672

Browse files
author
Release Manager
committed
gh-38997: Document RealIntervalField default printing configuration As in the title. Side note, is this actually a good idea? Maybe it was intended to be not modifiable… But modifying it has a practical advantage, sometimes you cannot control these two option otherwise e.g. if you have a list of elements you may need to extract each element and call `.str(...)` on it. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #38997 Reported by: user202729 Reviewer(s): Travis Scrimshaw
2 parents a0b5486 + 493d3f7 commit a986672

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/sage/rings/real_mpfi.pyx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,26 @@ satisfying, but we have chosen the latter.
120120
sage: a == 2
121121
False
122122
123+
Some default printing options can be set by modifying module globals::
124+
125+
sage: from sage.rings import real_mpfi
126+
sage: x = RIF(sqrt(2), sqrt(2)+1e-10); x
127+
1.4142135624?
128+
sage: real_mpfi.printing_error_digits = 2
129+
sage: x
130+
1.414213562424?51
131+
sage: real_mpfi.printing_style = 'brackets'
132+
sage: x
133+
[1.4142135623730949 .. 1.4142135624730952]
134+
sage: real_mpfi.printing_style = 'question'; real_mpfi.printing_error_digits = 0 # revert to default
135+
136+
The default value of using scientific notation can be configured at field construction instead::
137+
138+
sage: RealIntervalField(53, sci_not=False)(0.5)
139+
0.50000000000000000?
140+
sage: RealIntervalField(53, sci_not=True)(0.5)
141+
5.0000000000000000?e-1
142+
123143
COMPARISONS:
124144
125145
Comparison operations (``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``)

0 commit comments

Comments
 (0)