X
X
xmel892016-09-27 12:39:01
Python
xmel89, 2016-09-27 12:39:01

Why in Python 3.4 (math module), cos(0.5*pi) = 6.12?

screencast.com/t/7nFwYnB0B
As far as I remember from the school course cos, sin cannot be greater than 1. What's the matter? what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sts, 2016-09-27
@stunoff

math.cos(math.pi*0.5) = 6.123233995736766e-17
note the e-17 at the end of the number
https://www.tutorialspoint.com/python/python_numbe...

O
Oleg Tsilyurik, 2016-09-27
@Olej

[[email protected] etc]$ python3
Python 3.4.3 (default, Aug  9 2016, 15:36:17) 
[GCC 5.3.1 20160406 (Red Hat 5.3.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.cos(0.5*math.pi )
6.123233995736766e-17
>>>

Are there any other questions? ... according to the school course ... ;-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question