2018-06-11 10:00 GMT+02:00 Ronald Oussoren <ronaldousso...@mac.com>: >> [me suggestion PiMultiple class] > > What is the real world advantage of such a class? So far I’ve only seen > examples where the current behavior is said to be confusing for students. In > most cases where I have used math.sin the angle wasn’t a constant and wasn’t > an exact mulltiple of pi. > > Ronald
Im assuming the current math.pi would be converted to PiMultiple(1) When learning, it's rather easy to write and read the following: >>> from math import sin, pi, asin, cos >>> myangle = pi / 2 >>> sin(myangle) 1 >>> asin(1) "0.5π" # Currently: 1.5707963267948966 >>> cos(pi / 2) 0 # Currently: 6.123233995736766e-17 It helps clarity and understanding when you're coming to python from a math background. In universities, half of your values when working with angles are written as some multiple of pi (of some weird fraction involving it). Also, for the common angles, we'll gain accuracy (and perhaps we can avoid the infinite series for certain computations. That would be a win.). Also, you're countering the "confusing to students" part with your own production environment experience. Those aren't alike. And if this was done, your float-based production code wouldn't get slower or care any other way. What you implement and test with PiMultiple would work perfectly fine with any random float as well, just without the extra advantages. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/