Fix floating formatting#634
Conversation
edwardchalstrey1
left a comment
There was a problem hiding this comment.
Thanks, looks good to me
|
I do not understand why this is needed? When I run the tutorial myself it works fine. |
Same here actually which is why this didn't come up before, I wonder if this is also related to python version somehow? @d-kad which python version are you running locally? |
|
I wouldn't think this would have to do with Python version. Those numbers are always going to be But also I don't think the solution is the right one anyway. If in fact we have a situation where the data are rational we should print them as rational, not cast them to |
Python 3.9.6 |
It's the LCP eqm that is a rational here - see the types in my screenshot above |
|
Ahh, right, I was fixated on the change to the GNM output, which definitely ought not to be necessary. But yes, if for some reason we need to make a change, I would do it by removing the The distinction between exact and floating-point/approximate methods is an important one to get across to users, so I'm suggesting we try to set good examples by avoiding casting from rational to float ourselves. |
Sounds good, will push it shortly! |
As I mentioned test_tutorials errored for me on 3.11. I just created a new venv and got the same error again : platform darwin -- Python 3.11.14, pytest-9.0.0, pluggy-1.6.0 It works for me on 3.12: platform darwin -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0 |
|
Ok thanks all, as I mentioned for now the code runs on 3.13+ (looks like 3.12 as well as per Rahul's experiment), I'll open a better fix later - see #639 |


Convert Rational to float before using string formatting
Closes #633