microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
106.43k stars 6.27k forks source link

In Power Toys Run Calculator Plugin tan(pi/2) is defined. #32576

Open meesam4687 opened 1 month ago

meesam4687 commented 1 month ago

Microsoft PowerToys version

0.80.1

Installation method

PowerToys auto-update

Running as admin

Yes

Area(s) with issue?

PowerToys Run

Steps to reproduce

Type tan(pi/2) in run image

✔️ Expected Behavior

tan(pi/2) to not do anything like it does for other undefined values like it does to 5/0

❌ Actual Behavior

It gives tan(pi/2) as 16331239353195400

Other Software

No response

github-actions[bot] commented 1 month ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Jay-o-Way commented 1 month ago

Google shows something similar: image

meesam4687 commented 1 month ago

Google shows something similar: image

Screenshot_20240422_225746_Calculator The phone version gives domain error

htcfreek commented 1 month ago

@meesam4687 Can you describe when the input is incorrect? What numbers or mathematic rules are important here?

meesam4687 commented 1 month ago

@meesam4687 Can you describe when the input is incorrect? What numbers or mathematic rules are important here?

tan(pi/2) radians is not defined

and any odd multiple of pi/2 rad is not defined either. Example tan(pi/2) is not defined tan(3pi/2) is not defined tan(5pi/2) is not defined and so on.

pilgrimlyieu commented 4 weeks ago

This is not an issue of PowerToys Run Calculator. It's relevant to the representation of floating number (because Pi is an infinite non-recurring decimal, and it can't be stored exactly).

That means, due to floating point precision, it's not possible to obtain the exact value Pi/2, so the result is always finite.

You can use Python and NodeJS to get the similar result.

>>> from math import tan, pi
>>> tan(pi/2)
1.633123935319537e+16
> Math.tan(Math.PI/2)
16331239353195370

You can find more details in links below: