#2501·calculator

Hanging calc for some trig function calls

Author: divVerentCreated Sep 16, 2026Updated Sep 16, 2026

Describe the bug

Some trig functions can cause a really slow (or maybe endless?) loop.

Steps To Reproduce

  1. Switch to scientific mode.
  2. Switch to RAD mode.
  3. Type (0-9e9999).
  4. Click Trigonometry then sin.

Expected behavior

Either an error, or the correct value of sin(-9 * 10^9999).

Screenshots

Image

Device and Application Information

  • OS Build: 10.0.26100.0
  • Architecture: X64
  • Application Version: 11.2607.0.0
  • Region: en-US
  • Dev Version Installed: False

Additional context

https://github.com/microsoft/calculator/blob/4fd3fc53bade573ea2ac1e1ebad9bf603713f85e/src/CalcManager/CEngine/scicomm.cpp#L1130

This only checks against a positive bound of 1e100 - negative values totally ignore it.

In conjunction with this, scale2pi at https://github.com/microsoft/calculator/blob/4fd3fc53bade573ea2ac1e1ebad9bf603713f85e/src/CalcManager/Ratpack/support.cpp#L506 seems O(n^3) with n being the number of digits of the input.

When trying smaller values, it seems to imply the above expression isn't an endless loop but will take about 15 minutes to run while calc is unresponsive. So not sure if this counts as a bug or not, but it seems there is intent to prevent this by blocking positive values above 1e100.

Requested Assignment I'm just reporting this problem. I don't want to fix it.