Tan of 90 in Google Chrome (JavaScript) -
this question has answer here:
when evaluate either of these statements in stable version of chrome (version 32.0.1700.107) value that's not infinity
.
math.tan(90 * math.pi / 180) 16331778728383844 math.tan(math.pi/2) 16331778728383844
what root of problem? math.tan not reassigned new value elsewhere in code.
the rounding errors. same reason math.cos(math.pi/2)
won't give 0.
update: gives 0 on latest version of chrome/node - judging open issue, it's considered regression in v8. still (and it's mentioned in issue's discussion), math.sin/cos
implementation-dependent approximations, , expecting behave in uniform way across board is, sadly, overoptimistic.
Comments
Post a Comment