Opened 3 years ago
Closed 2 years ago
#26156 closed defect (fixed)
0.0 is printed with too many digits
Reported by:  jdemeyer  Owned by:  

Priority:  major  Milestone:  sage8.7 
Component:  user interface  Keywords:  
Cc:  Merged in:  
Authors:  Jeroen Demeyer  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  a5911da (Commits, GitHub, GitLab)  Commit:  a5911dafeebbb480301ab6b34980b0f93b722102 
Dependencies:  Stopgaps: 
Description (last modified by )
sage: RR(0).str(digits=3) '0.000'
This is trivial to fix, but then it causes hundreds of doctest failures since every real zero is printed with one less digit. To compensate for this, we add one extra digit for 0.0 in the default case.
Change History (10)
comment:1 Changed 3 years ago by
 Branch set to u/jdemeyer/ticket/26156
comment:2 Changed 3 years ago by
 Commit set to 39ca504876f8bab2deee709cccd78ef087aea92a
comment:3 Changed 3 years ago by
 Description modified (diff)
comment:4 Changed 3 years ago by
 Commit changed from 39ca504876f8bab2deee709cccd78ef087aea92a to e26788a1a8bbe3b1b8cc49d77376094cce6b3e0f
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
e26788a  Print 0.0 with the correct number of digits

comment:5 Changed 3 years ago by
 Status changed from new to needs_review
comment:6 Changed 2 years ago by
 Commit changed from e26788a1a8bbe3b1b8cc49d77376094cce6b3e0f to a5911dafeebbb480301ab6b34980b0f93b722102
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
a5911da  Print 0.0 with the correct number of digits

comment:7 Changed 2 years ago by
 Dependencies #26154 deleted
 Milestone changed from sage8.4 to sage8.7
comment:8 followup: ↓ 9 Changed 2 years ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
It is a little annoying to have that one special case just to make this less of a patchbomb. However, we can always address that on a later ticket as it is the precedent.
comment:9 in reply to: ↑ 8 Changed 2 years ago by
Replying to tscrim:
It is a little annoying to have that one special case just to make this less of a patchbomb. However, we can always address that on a later ticket as it is the precedent.
On the other hand, do you really care whether it's 0.000000000000000
or 0.00000000000000
? What's important is that the number of digits is correct when you specifically ask for a given number of digits.
comment:10 Changed 2 years ago by
 Branch changed from u/jdemeyer/ticket/26156 to a5911dafeebbb480301ab6b34980b0f93b722102
 Resolution set to fixed
 Status changed from positive_review to closed
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
Print 0.0 with the correct number of digits