From 83a50fa06a6770a217ae74a02a7de697c319520e Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 14 Mar 2026 16:43:41 -0600 Subject: [PATCH] Revert to calc before tests --- calculator/calculator.app.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/calculator/calculator.app.js b/calculator/calculator.app.js index 7e26e50..2622016 100644 --- a/calculator/calculator.app.js +++ b/calculator/calculator.app.js @@ -193,7 +193,7 @@ function toExponential(num, precision) { function fixFloat(n) { if (Math.abs(n) < 1e-10) return 0; - return parseFloat(n.toPrecision(14)); + return n; } function addSeparators(s) { @@ -364,8 +364,6 @@ function buttonPress(val) { operator = null; prevExpression = null; currExpression = ""; - angleMode = 'deg'; - scientificOperators.angleMode.val = angleMode; } else { specials.R.val = 'AC'; drawKey('R', specials.R, true); @@ -390,7 +388,7 @@ function buttonPress(val) { displayOutput(results); prevExpression = "sqrt(" + prevExpression + ")"; } else if (currNumber != null) { - currNumber = Math.sqrt(parseFloat(currNumber)); + currNumber = Math.sqrt(currNumber); displayOutput(currNumber); currExpression = "sqrt(" + currExpression + ")"; } @@ -419,7 +417,7 @@ function buttonPress(val) { displayOutput(results); prevExpression = "sin(" + prevExpression + ")"; } else if (currNumber != null) { - let angle = parseFloat(currNumber); + let angle = currNumber; if (angleMode === 'deg') { angle = angle * Math.PI / 180; } @@ -439,7 +437,7 @@ function buttonPress(val) { displayOutput(results); prevExpression = "cos(" + prevExpression + ")"; } else if (currNumber != null) { - let angle = parseFloat(currNumber); + let angle = currNumber; if (angleMode === 'deg') { angle = angle * Math.PI / 180; } @@ -459,7 +457,7 @@ function buttonPress(val) { displayOutput(results); prevExpression = "tan(" + prevExpression + ")"; } else if (currNumber != null) { - let angle = parseFloat(currNumber); + let angle = currNumber; if (angleMode === 'deg') { angle = angle * Math.PI / 180; } @@ -475,7 +473,7 @@ function buttonPress(val) { displayOutput(results); prevExpression = "log(" + prevExpression + ")"; } else if (currNumber != null) { - currNumber = Math.log(parseFloat(currNumber)) / Math.LN10; + currNumber = Math.log(currNumber) / Math.LN10; displayOutput(currNumber); currExpression = "log(" + currExpression + ")"; } @@ -487,7 +485,7 @@ function buttonPress(val) { displayOutput(results); prevExpression = "10^(" + prevExpression + ")"; } else if (currNumber != null) { - currNumber = Math.pow(10, parseFloat(currNumber)); + currNumber = Math.pow(10, currNumber); displayOutput(currNumber); currExpression = "10^(" + currExpression + ")"; } @@ -499,7 +497,7 @@ function buttonPress(val) { displayOutput(results); prevExpression = "ln(" + prevExpression + ")"; } else if (currNumber != null) { - currNumber = Math.log(parseFloat(currNumber)); + currNumber = Math.log(currNumber); displayOutput(currNumber); currExpression = "ln(" + currExpression + ")"; } @@ -511,7 +509,7 @@ function buttonPress(val) { displayOutput(results); prevExpression = "e^(" + prevExpression + ")"; } else if (currNumber != null) { - currNumber = Math.exp(parseFloat(currNumber)); + currNumber = Math.exp(currNumber); displayOutput(currNumber); currExpression = "e^(" + currExpression + ")"; }