+ 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 Answers

+ 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....

Hot today

Please help, any idea?

2 Votes

Loop question, I've tried everything that I knew I just don't know. Please help me solve it out

1 Votes

What is wrong? Error on test.

1 Votes

Help me solve this (using loop)

1 Votes

Help me wiht python

1 Votes

how can i flip any word with c++

0 Votes