-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added min_fixed and max_fixed options for Float in printers #18477
Conversation
Mpmath module has min_fixed and max_fixed options for printing floating point numbers and in this commit, these options are exposed for StrPrinter, LatexPrinter and all its subclasses
✅ Hi, I am the SymPy bot (v149). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.6. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
I'd agree to add this to string printers, |
Ok @sylee957, I will add min_fixed and max_fixed options only for Latex printers and string printers. |
Codecov Report
@@ Coverage Diff @@
## master #18477 +/- ##
==============================================
- Coverage 75.323% 53.592% -21.732%
==============================================
Files 637 640 +3
Lines 167068 167185 +117
Branches 39416 39429 +13
==============================================
- Hits 125842 89599 -36243
- Misses 35692 71744 +36052
- Partials 5534 5842 +308 |
Restricting the min and max options for printing floating point numbers to string and latex printers
In this commit, some of the options were left unedited that were supposed to be removed in the last commit. This commit fixes that.
Updates to docstring of rust.py in first commit were removed and safe check in getting low and high values was added in latex pri- -nters code
This needs tests. I wouldn't put this in the code printers. For the code printers, it is more important to print the exact float value so precision isn't lost. Different parameters might exist to approximate float literals in the code printers, but those would work differently than these, which are based on visual output rather than mathematical rounding. |
@asmeurer thanks for your feedback! I have already removed the options from codeprinters. I will start making test cases for latex printers and string printers and will add them soon along with updating the docstring for adding this feature. |
For testing the new functionality added for Float printing, tests are added in sympy.printing
@asmeurer I have added the tests for string printers as of now. Working on tests for latex printers. |
In this commit, tests for checking the printing of float numbers by latex printers were added and some minor changes to latex.py was made.
References to other Issues or PRs
Fixes #7847
Brief description of what is fixed or changed
--> Exposed min_fixed and max_fixed options for printers to print floating point numbers
Other comments
Example:
As you can see, the bounds are exclusive.
Release Notes
be printed in fixed-point format.