3 ms·
The SymPy author was explicitly talking about users. The sort of folks that use matlab, mathematica, and maple. I don't know of any of them that expect 2 / 3
by x0x0 10y ago
The SymPy author was explicitly talking about users. The sort of folks that use matlab, mathematica, and maple.
I don't know of any of them that expect 2 / 3 to be an integer.
And as ufo says, it creates subtle bugs because it works right on most data until you just happen to get a pair of ints. Then boom.
eg in Matlab all numbers are doubles unless you take action to make them otherwise.
- nomel 10y agoHaving a function/operator return different results depending on the type seems a bit insane, from a non-C/Python perspective. > There should be one-- and preferably only one --obvious way to do it. If I divide 1 in half, I'm left with 0.5.
- dwc 10y agoThere's a better way. (/ 2 3) ; => 2/3 (/ 2.0 3) ; => 0.6666667