Bug 155896 - Libre Calc does not do the PEMDAS functions correctly
Summary: Libre Calc does not do the PEMDAS functions correctly
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.1.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-17 12:03 UTC by DK Adey
Modified: 2023-06-17 17:39 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DK Adey 2023-06-17 12:03:56 UTC
Description:
When I type in the following equation "20/2(7-2)" Libre Office changes it to "20/2X(7-2)". In THIS case, it adds another multiplication function to the equation. That creates the WRONG answer because it changes the PEMDAS Order. In PEMDAS, ALL of the Parenthesis's functions MUST be completed, PRIOR to finishing the equation. 

SO, If you have:
20/2(7-2)=
20/2(5)= (MUST FINISH THE PARENTHESES!!!)
20/10=
2

You do NOT go:
20/2(7-2)=
20/2(5)=
20/2X5= NOT!!!!!
so it will NOT go
10X5= WRONG!!!!

Actual Results:
20/2(7-2)=
20/2X(7-2)= YOU DO NOT Add a multiplication step to the formula!
20/2X5=
20/2X5= NOT!!!!!
so it will NOT go
10X5= WRONG!!!!

Expected Results:
20/2(7-2)=
20/2(5)= (MUST FINISH THE PARENTHESES!!!)
20/10=
2



Reproducible: Always


User Profile Reset: No

Additional Info:
I am not sure why, but even when I use Microsoft Scientific Calculator, it puts in the extra step.
Comment 1 ady 2023-06-17 15:41:06 UTC
A formula such as:
=20/2(7-2)

...would return Err:509, Operator missing (between the 2 and the parenthesis).

In Calc, the multiplication operator has to be there.

Additionally, there are priorities that are assumed by Calc, which can be changed by using additional parentheses; for example:
=20/(2*(7-2))

Please search for info in the online help, the user mailing lists, or use https://ask.libreoffice.org next time before posting a bug report.

Closing as NOTABUG.
Comment 2 Eike Rathke (retired, only occasionally showing up) 2023-06-17 17:39:18 UTC
2(7-2) is *NOT* a valid spreadsheet formula expression because it lacks an operator between 2 and (7-2). Specifically, 20/2(7-2) would never be evaluated as 20/(2*(7-2)) or 20/2/(7-2) what you seem to expect, not even by a TI calculator.
Even WolframAlpha agrees that 20/2(7-2) is evaluated as 20/2*(7-2)
https://www.wolframalpha.com/input?i=20%2F2%287-2%29