diff --git a/src/blocks/scratch3_operators.js b/src/blocks/scratch3_operators.js index c6ee70bef..a3dc9557a 100644 --- a/src/blocks/scratch3_operators.js +++ b/src/blocks/scratch3_operators.js @@ -136,8 +136,8 @@ class Scratch3OperatorsBlocks { case 'floor': return Math.floor(n); case 'ceiling': return Math.ceil(n); case 'sqrt': return Math.sqrt(n); - case 'sin': return parseFloat(Math.sin((Math.PI * n) / 180).toFixed(10)); - case 'cos': return parseFloat(Math.cos((Math.PI * n) / 180).toFixed(10)); + case 'sin': return Math.round(Math.sin(n % 360 / 180 * Math.PI) * 1e10) / 1e10; + case 'cos': return Math.round(Math.cos(n % 360 / 180 * Math.PI) * 1e10) / 1e10; case 'tan': return MathUtil.tan(n); case 'asin': return (Math.asin(n) * 180) / Math.PI; case 'acos': return (Math.acos(n) * 180) / Math.PI;