Inside Our Online Scientific Calculator: Degree Conversion, log vs ln, and the Percent Trap

Your Expression Gets Rewritten, Then Evaluated

The calculator does not parse your expression with a custom engine. It rewrites it into a JavaScript arithmetic expression and evaluates that.

The rewrite happens in a fixed order. PI becomes the numeric value of pi. A standalone e becomes the numeric value of Euler's number. The caret becomes the exponent operator. Then ln( becomes a natural logarithm call, log( becomes a base 10 logarithm call, and sqrt( becomes a square root call.

The rewrite has one protective rule around the e constant. An e directly followed by a digit stays untouched, so a constant substitution cannot corrupt anything that looks like a number with an exponent marker.

A character allowlist runs after the rewrite. Any leftover character outside numbers, operators, parentheses, and recognized function names throws an error before evaluation. The result must also be a finite number, so division by zero fails instead of showing infinity.

log Is Base 10, ln Is Base e

The two logarithm buttons map to different functions, and mixing them up shifts your result by a factor of about 2.3. Verified outputs from our run.

  • log(1000) returns 3, because 10 to the power of 3 is 1000.
  • log(100) returns 2.
  • ln(e) returns 1, because e to the power of 1 is e.

Use log( for decibel, pH, and Richter style work that assumes base 10. Use ln( for continuous growth and calculus work that assumes base e.

Degree Mode Multiplies Your Argument

The calculator starts in degree mode. The mode button displays the active mode, DEG or RAD, and one tap switches it.

In degree mode, every sine, cosine, and tangent call gets an injected factor that converts degrees to radians before the trigonometry runs. Verified values in degree mode include sin(30) as 0.5, cos(60) as 0.5, tan(45) as 1, and sin(90) as 1.

The trap is pi. In radian mode, sin(PI/6) returns 0.5 as expected. In degree mode, the same input returns 0.0091383954, because the calculator multiplies the already correct radian argument by the conversion factor a second time. The rule is strict. Enter plain numbers in degree mode, and enter expressions containing PI only in radian mode.

The mode affects trigonometry only. The logarithm, natural logarithm, and square root rewrites are identical in both modes, so switching modes never changes those results.

The Percent Key Is a Remainder Operator

The percent button inserts the percent sign, and JavaScript evaluates that sign as the remainder operator. It does not divide by 100. Our verified run returns 1 for 7%2, because 7 divided by 2 leaves remainder 1.

To compute a percentage, convert it to a decimal yourself. 15 percent of 80 is 80 x 0.15. This is the single most misleading key on the tool, so treat it as modulo only.

Verified Reference Values

These outputs come from our direct run of the evaluation function.

  • 2^10 returns 1024.
  • sqrt(2) returns 1.4142135624.
  • 2+3*4 returns 14, confirming standard precedence.
  • (1+2)*3 returns 9.
  • PI alone returns 3.1415926536.
  • e alone returns 2.7182818285.

The display rounds every result to ten decimal places and drops trailing zeros. That is why pi shows as 3.1415926536 rather than the full stored precision.

The display starts at zero, and the first entry replaces it. The DEL key removes the last character, and the C key clears everything back to zero. Input comes only from the on-screen buttons, so corrections happen key by key.

Error Behavior You Will Meet

Two verified failure cases show the error path. The input 1/0 fails the finite check and displays Error. An incomplete expression such as 2** fails evaluation and also displays Error. When you see Error, check for an unclosed parenthesis, an empty operand, or a division by zero before you blame the mode setting.

What the Tool Does Not Have

There is no factorial key, no inverse trigonometry, and no memory slots. There is also no expression history to recall after a clear. These absences keep the tool small, and they mean some textbook problems need a different tool.

Steps to Avoid the Three Common Errors

1. Check the mode button before any trigonometry, and match it to your angle units.

2. Pick log( for base 10 and ln( for base e, every time.

3. Replace percent intentions with decimal multipliers before pressing equals.

4. Close every parenthesis you open.

5. Keep degree mode for plain numbers and radian mode for PI expressions.

Checklist Before You Trust a Result

  • [ ] Mode matches your angle units.
  • [ ] Correct logarithm base chosen.
  • [ ] No percent sign used as a percentage.
  • [ ] Parentheses balanced.
  • [ ] Result sanity checked against a rough estimate.

If you hit a result that looks wrong, send us the exact key sequence and the mode. Reproducible wrong-looking outputs are usually the degree and pi interaction above, but we log every report against the rewrite rules. Try your own expression on the [scientific calculator](/en/scientific-calculator).