fix: Fix Math.log10 not found error using Math.log equivalent
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -217,7 +217,7 @@ function toExponential(num, precision) {
|
|||||||
sign = "-";
|
sign = "-";
|
||||||
num = -num;
|
num = -num;
|
||||||
}
|
}
|
||||||
var exp = Math.floor(Math.log10(num));
|
var exp = Math.floor(Math.log(num) / Math.LN10);
|
||||||
var mantissa = num / Math.pow(10, exp);
|
var mantissa = num / Math.pow(10, exp);
|
||||||
|
|
||||||
var mantissaFixed = mantissa.toFixed(precision);
|
var mantissaFixed = mantissa.toFixed(precision);
|
||||||
@@ -452,10 +452,10 @@ function buttonPress(val) {
|
|||||||
break;
|
break;
|
||||||
case 'log':
|
case 'log':
|
||||||
if (results != null) {
|
if (results != null) {
|
||||||
results = Math.log10(results);
|
results = Math.log(results) / Math.LN10;
|
||||||
displayOutput(results);
|
displayOutput(results);
|
||||||
} else if (currNumber != null) {
|
} else if (currNumber != null) {
|
||||||
currNumber = Math.log10(currNumber);
|
currNumber = Math.log(currNumber) / Math.LN10;
|
||||||
displayOutput(currNumber);
|
displayOutput(currNumber);
|
||||||
}
|
}
|
||||||
hasPressedNumber = false;
|
hasPressedNumber = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user