+ 2
math module makes confusing!
>>> import math >>> math.cos(math.pi/2) 6.123233995736766e-17 >>> math.acos(0) 1.5707963267948966 >>> math.pi/2 1.5707963267948966 As I learn cos(pi/2) = 0 that means acos(0) = pi/2 why cos(pi/2) = 6.123233995736766e-17
9 ответов
+ 7
You could read up more in the python stuff on their documentationsfof each version.
Search Python Documentation on Google
+ 6
This actually *is* zero, with a floating-point accuracy! ;)
https://en.m.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems
+ 3
in advance,the PI representation is not real but it is also truncated with an appropriate accuracy and its half has less accuracy than in real.This is caused by mashine representation of decimal number(floating points operations).
+ 1
Ahha! I got it @sayan chandra.
0
here is it...check the output against each line of code...
https://code.sololearn.com/cI1NCJ9BwpBA/?ref=app
0
see this second verson of explaination
@SENG THAI
Red all the comments in code.
https://code.sololearn.com/cCo62gBgC4kG/?ref=app
0
@sayan chandra Thanks! But Why it shows up as exponential value. It is because it can not show all the floating number after ".", isn't it?
0
of course..
exactly
0
somewhere anyway u have to end...
cause this floating points hav no end..
like 10 divided by 3....