You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The words "string" and "trigonometric function" should not be anywhere near each other
Actual Behavior
The current implementations of the sin, cos, and tan functions (but not the asin, acos, and atan functions) stringify inputs to 10 decimal digits then un-stringify them.
This was introduced in #422 so that values which should be 0 but aren't due to rounding error (e.g. sin(180)) are rounded to 0. There's likely a much faster way to do this, though (see this benchmark).
The text was updated successfully, but these errors were encountered:
ecc521
added a commit
to ecc521/scratch-vm
that referenced
this issue
Jun 10, 2019
Fixscratchfoundation#2198 and scratchfoundation#2199
Take angle modulus 360 to avoid issues with floating point decimal accuracy.
Round to 10 digits using Math.round and division instead of stringifying.
Expected Behavior
The words "string" and "trigonometric function" should not be anywhere near each other
Actual Behavior
The current implementations of the
sin
,cos
, andtan
functions (but not theasin
,acos
, andatan
functions) stringify inputs to 10 decimal digits then un-stringify them.This was introduced in #422 so that values which should be 0 but aren't due to rounding error (e.g. sin(180)) are rounded to 0. There's likely a much faster way to do this, though (see this benchmark).
The text was updated successfully, but these errors were encountered: