Bug 488613 - tan(π / 2) does not return undefined in radian mode
Summary: tan(π / 2) does not return undefined in radian mode
Status: CONFIRMED
Alias: None
Product: kcalc
Classification: Applications
Component: general (show other bugs)
Version: 24.05.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Gabriel Barrantes
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-17 08:54 UTC by Yorimirus
Modified: 2024-06-20 23:50 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yorimirus 2024-06-17 08:54:25 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY

Inputting tan(π / 2) into KCalc does not return a correct value. 
You can get pi in the Constants>Mathematics dropdown, which is what I used.

STEPS TO REPRODUCE
1. Set input mode to RAD
2. Input tan(pi / 2)
3. Press enter to calculate the result

OBSERVED RESULT

KCalc returns -6,05546978455e+12

EXPECTED RESULT

KCalc should return "undefined" or nan or some other value indicating there is no result.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  openSUSE Tumbleweed, KDE Plasma 6
(available in About System)
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1

ADDITIONAL INFORMATION

Entering tan(90) in the degree mode seems to return nan like it should, so maybe this is a rounding error?

Desmos, Photomath and Wolframalpha return correct values.
Comment 1 Gabriel Barrantes 2024-06-20 23:50:59 UTC
This is an old bug that is now more notorious due to the input display showing the "π", it is a rounding error, the π symbol gets converted to its decimal form and not to the originally intended KNumber Pi(), (https://invent.kde.org/utilities/kcalc/-/blob/master/knumber/knumber.h?ref_type=heads#L42)... I will look into it...