-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
display of Rational
s in containers
#42626
Comments
I do think it looks better and it follows similar principles use elsewhere to write things compactly if the extra information can be gotten from the printed element type. |
Another thought might be to display julia> [1//2 1//4]
1×2 Matrix{Rational{Int64}}:
1//2 1//4 as something along the lines of [2 1] // 4 There are numerous challenges, though, such as when the |
For Tim's proposal my only wish is that the definition of |
Relevant: Unicode has a fraction slash ( |
Fixed by #45396 |
In my work, I often have to work with
Rational
matrices resulting fromsimple mathematical operations on integer matrices, like:
I find the display rather hard to read. I tried for a long time to think
what could be the least disruptive and least controversial change to the
display of rational numbers which could improve the situation. I came up
with the following
here the only change is the
if
line, which says if theRational
numberis actually an integer, display it as an integer, if the type of the
current container has already been printed. I think this would cause no
problem: I cannot think of a situation where a
Rational
Vector
,Matrix
orArray
would be wrongly read/interpreted because of this. Andit already considerably improves the display. In the example above we get
even in matrices which do not contain many integers, the simple fact that
0
displays as
0
and not0//1
makes things better.What do you think about that?
The text was updated successfully, but these errors were encountered: