Skip to content

Hanging calc for some trig function calls #2501

Description

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

return m_currentVal >= m_maxTrigonometricNum;

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

In conjunction with this, scale2pi at

void scale2pi(_Inout_ PRAT* px, uint32_t radix, int32_t precision)
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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions