Home › Forums › CSS › Whence this wobble? › Reply To: Whence this wobble?
January 2, 2018 at 9:56 pm
#264806
Shikkediel
Participant
I came across a weird glitch in Opera where one of the values would turn out to be 1.22465-16
, a very small number I would think but not recognised as such – it would return NaN
.
So this is a safer cross browser approach:
if (values.length > 6) var angle = Math.round(Math.atan2(Number(values[6]) || 0, values[5])*180/Math.PI));
else angle = 0;
Edit – I now realise that it’s probably because the regex that is alternatively used strips out the exponential notation (so not necessarily a browser quirk even though it did not occur in FF or IE)…