feat: add pow10 and exp arithmetic operations
This commit is contained in:
@@ -237,22 +237,8 @@ function execute(name) {
|
||||
if (calc.isEditing) {
|
||||
calc.inputValue = calc.inputValue.startsWith('-') ? calc.inputValue.slice(1) : `-${calc.inputValue}`;
|
||||
} else {
|
||||
calc.push(calc.pop() * -1);
|
||||
calc.command('neg');
|
||||
}
|
||||
} else if (name === 'pow10') {
|
||||
pushEditingValueIfNeeded();
|
||||
const exponent = calc.stack[0];
|
||||
calc.remove(0);
|
||||
calc.push(10);
|
||||
calc.push(exponent);
|
||||
calc.command('pow');
|
||||
} else if (name === 'exp') {
|
||||
pushEditingValueIfNeeded();
|
||||
const exponent = calc.stack[0];
|
||||
calc.remove(0);
|
||||
calc.push(Math.E);
|
||||
calc.push(exponent);
|
||||
calc.command('pow');
|
||||
} else {
|
||||
pushEditingValueIfNeeded();
|
||||
calc.command(name);
|
||||
|
||||
Reference in New Issue
Block a user