[Python-ideas] Trigonometry in degrees
Steven D'Aprano
steve at pearwood.info
Fri Jun 8 02:22:07 EDT 2018
On Fri, Jun 08, 2018 at 02:37:33PM +0900, Stephen J. Turnbull wrote:
> My bias is that people who want to program this kind of thing just
> need to learn about floating point numbers and be aware that they're
> going to have to accept that
>
> >>> from math import cos, radians
> >>> cos(radians(90))
> 6.123233995736766e-17
> >>>
>
> is good enough for government work, including at the local public high
> school.
In Australia, most secondary schools recommend or require CAS
calculators from about Year 10, sometimes even from Year 9. Most (all?)
state curricula for Year 11 and 12 mandate CAS calculators. Even
old-school scientific calcuators without the fancy CAS symbolic maths
are capable of having cos(90) return zero in degree mode.
It is quite common for high school students to expect cos(90°) to come
out as exactly zero. And why not? It's the 21st century, not 1972 when
four-function calculators were considered advanced technology :-)
To my mind, the question is not "should we have trig functions that take
angles in degrees" -- that's a no-brainer, of course we should. The only
questions in my mind are whether or not such a library is (1)
appropriate for the stdlib and (2) ready for the stdlib.
--
Steve
More information about the Python-ideas
mailing list