lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I just discovered that math.atan2 doesn't handle the case of y=0
properly, at least in Lua 5.1:

> a, b = {-1, 0}, {1, 0}
> =math.deg(math.atan2(b[2] - a[2], b[1] - a[1]))

Surely the result should be 180, since these two vectors point in
opposite directions? But atan2 doesn't handle this correctly, and the
manual doesn't mention this. Is it a known issue?

Sent from my toaster.