Jul-08-2023, 08:24 PM
While testing python code to rotate 3d points, I tried:
cos_ = np.cos((90.0/360.0) * (2.0*np.pi))
cos(90) was reported as 6.123234e-17, instead of correct value of zero.
tried both math.pi and numpy.pi with same result
os = windows 10, cpu = Intel i5-7200U
python = 3.8.10 provided by anaconda spyder 5.4.3
The same behavior occurred on Linux Mint os, using python 3.8.10 provided by anaconda spyder 4.5.3, cpu = AMD whatever
A simple c program compiled by gcc and executed on the Linux machine reported cos(90) as zero.
What causes this problem? What can be done about it?
cos_ = np.cos((90.0/360.0) * (2.0*np.pi))
cos(90) was reported as 6.123234e-17, instead of correct value of zero.
tried both math.pi and numpy.pi with same result
os = windows 10, cpu = Intel i5-7200U
python = 3.8.10 provided by anaconda spyder 5.4.3
The same behavior occurred on Linux Mint os, using python 3.8.10 provided by anaconda spyder 4.5.3, cpu = AMD whatever
A simple c program compiled by gcc and executed on the Linux machine reported cos(90) as zero.
What causes this problem? What can be done about it?