Author Topic: EEVblog 1479 - Is Your Calculator WRONG?  (Read 13487 times)

0 Members and 1 Guest are viewing this topic.

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 1208
  • Country: pl
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #25 on: June 17, 2022, 09:44:26 pm »
I know a company that did their economic projection modelling on Excel and due to an actual bug in regression modelling lost a lot of money. Microsoft know it exists and won't fix it because it might break millions of spreadsheets worldwide.
While I myself never seen that leading to any catastrophe, the widespread use of spreadsheets for statistical modelling in demographics and macroeconomy was always filling me with dread. Each time I received a model to work on, expressed as an Excel document, I was shivering. With author blissfully unaware of floating point calculation issues, rounding for display or that various “magical” textual entries may be interpreted not as they think they are. Chances of that introducing a substantial error are acceptably low and it wouldn’t undermine the entire model, but it is always smelly.

In their defense: using dedicated statistical/maths software would not automatically solve that. Tools like SAS or MATLAB are unauditable anyway. Open software is, but in the end those people lack knowledge to evaluate the implementation by themselves. But using a piece of software, that was never designed with that purpose in mind, with unwavering confidence is still scary.
People imagine AI as T1000. What we got so far is glorified T9.
 
The following users thanked this post: bd139

Offline Neilm

  • Super Contributor
  • ***
  • Posts: 1546
  • Country: gb
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #26 on: June 18, 2022, 11:17:42 am »
I just tried this on the app I use on my phone. The first thing it did was ask me which version did I want then saved that as a setting.
Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe. - Albert Einstein
Tesla referral code https://ts.la/neil53539
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9008
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #27 on: June 19, 2022, 04:21:13 am »
If that calculator feature will ruin your day, don't look up the Excel quirks!
Reverse engineering of a rather infamous Excel floating point bug:
https://web.archive.org/web/20181120193921/http://www.lomont.org/Math/Papers/2007/Excel2007/Excel2007Bug.pdf
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 
The following users thanked this post: bd139

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #28 on: June 21, 2022, 12:39:27 am »
...in the real world of mathematics and engineering, adjacent terms bind more tightly than operators. Therefore a/bc is understood to be \$\frac{a}{bc}\$

Similarly, 6/2(2+1) would be read as \$\frac{6}{2(2+1)}\$

If there is any possibility of misinterpretation, then...

... HP-RPN to the rescue!



RPN 'Reverse Polish Notation' HP-41CX (above) evaluates in this order: start with parentheses first, then work outwards.
6/2(2+1)

2 ENTER 1 + 2 x 6 /
1.0000   :-+



Now I use an HP-28S (below) in algebraic mode:  :horse:



'6/2(2+1)' >> Syntax Error      :-//

Hence edit to...

'6/2x(2+1)' EVAL
9.0000  :--

or...

'6/(2x(2+1))' EVAL
1.0000   :-+


Now in HP-28S RPN:
2 ENTER 1 + 2 x 6 /
1.0000   :-+

 :phew:

Lesson: ...stick with 'explicit' RPN at all times to eliminate any 'implied' algebraic errors!
« Last Edit: June 21, 2022, 01:43:23 am by Scherms »
 
The following users thanked this post: bd139

Online IanB

  • Super Contributor
  • ***
  • Posts: 11859
  • Country: us
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #29 on: June 21, 2022, 03:15:47 am »
Lesson: ...stick with 'explicit' RPN at all times to eliminate any 'implied' algebraic errors!

Yes, except in RPN you determine the order of operations by your key entry.

"Say what to do, and do what I say."

For example:

6 ENTER 2 ÷ 2 ENTER 1 + ×
9.0000

So you can get any answer you wish to get  :)
 

Offline kjpye

  • Contributor
  • Posts: 32
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #30 on: June 21, 2022, 04:43:21 am »

RPN 'Reverse Polish Notation' HP-41CX (above) evaluates in this order: start with parentheses first, then work outwards.
6/2(2+1)

2 ENTER 1 + 2 x 6 /
1.0000   :-+


Which is only coincidentally the correct answer! That is the answer to calculating 2(2+1)/6.

Try 2 ENTER 1 + 2 × 6 X<->Y /
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11859
  • Country: us
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #31 on: June 21, 2022, 05:02:28 am »
Which is only coincidentally the correct answer! That is the answer to calculating 2(2+1)/6.

Try 2 ENTER 1 + 2 × 6 X<->Y /

Ah, but this is why there is a stack. And why not everyone can deal with RPN:

6 ENTER 2 ENTER ENTER 1 + × ÷
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23018
  • Country: gb
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #32 on: June 21, 2022, 06:15:34 am »
Lesson: ...stick with 'explicit' RPN at all times to eliminate any 'implied' algebraic errors!

Yes, except in RPN you determine the order of operations by your key entry.

"Say what to do, and do what I say."

For example:

6 ENTER 2 ÷ 2 ENTER 1 + ×
9.0000

So you can get any answer you wish to get  :)

Only if you’re an idiot  :-DD
 
The following users thanked this post: Scherms

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #33 on: June 21, 2022, 12:56:50 pm »
Lesson: ...stick with 'explicit' RPN at all times to eliminate any 'implied' algebraic errors!

Yes, except in RPN you determine the order of operations by your key entry.

"Say what to do, and do what I say."

For example:

6 ENTER 2 ÷ 2 ENTER 1 + ×
9.0000

So you can get any answer you wish to get  :)

 :palm:


Eh, NO!  :horse:

With RPN you start within the parentheses first and then work outwards. It is not strictly 'left to right' like in your example.

Go on, admit that you're a TI guy, we'll understand...  :popcorn:

« Last Edit: June 21, 2022, 01:19:19 pm by Scherms »
 

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #34 on: June 21, 2022, 01:39:37 pm »
Try this online HP15C RPN calculator yourself to confirm method.



https://hp15c.com/web/hp15c.html

 8)

« Last Edit: June 21, 2022, 01:43:10 pm by Scherms »
 
The following users thanked this post: bd139

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #35 on: June 22, 2022, 01:05:19 pm »


Is your calculator WRONG? It could be!
Looking at the issue of implied multiplication and how it can affect your calculations. Why do some Casio and TI calculators give a different result to others? And why do they differ from your phone calculator, google calculator, or Wolfram Alpha?
How Order of Operations matters.



 :palm:

TexASS Instruments!
...no wonder NASA went with HP...
:-DD

« Last Edit: June 22, 2022, 06:33:34 pm by Scherms »
 
The following users thanked this post: bd139

Offline Vtile

  • Super Contributor
  • ***
  • Posts: 1144
  • Country: fi
  • Ingineer
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #36 on: June 22, 2022, 08:46:26 pm »
Eh, NO!  :horse:

With RPN you start within the parentheses first and then work outwards. It is not strictly 'left to right' like in your example.

The actual problem in this expression and evaluation is not "parentheses" first so much, but a pattern recognition of the reader. How does he/she/they interpret what is written on the expression. After all mathematics are whole lots of pattern recognition, when it comes to many things, expression solving is no exception on this.

ie.
6:2(2+1)
6/2(2+1)
6/(2+1)2

Same with the -1² = -1 (as I have understood that it is now somewhat standard form in printed math), while I doubt there is none who actually uses math as tool puts this as result when using a pen and paper with same marking on paper, in other words would use parenthesis as (-1)²=1. In the other hand this is answer logical since what it actually contains is as far as I know actually (-1)*1² as in following expression: a-(b-c)=a+(-b)+c=a+(-1)(b-c)=a+[-1b+((-1)²)c] ... which to my eyes are again one of those pesky implied multiplications btw.

..but again -1²=-1 is illogical in a way the algebra is thought in ie. with quadratic formula ... aX²+bX+c is many times written as 1X²-6X+8, where b=-6 and transferred to formula ... what should be written is actually 1X²+[(-1)6]X+8 where b=(-1)6  .... with this former "style" -1² is actually +(-1)²

summa summarum.. use your head and do test calculation(s) if context do not reveal the intended formatting ...

...it seems it is a bed time, one should not take a "quick" look of eevblog in the middle of night. :D
« Last Edit: June 22, 2022, 10:19:51 pm by Vtile »
 
The following users thanked this post: bd139

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #37 on: June 23, 2022, 04:03:05 am »
Eh, NO!  :horse:

With RPN you start within the parentheses first and then work outwards. It is not strictly 'left to right' like in your example.

The actual problem in this expression and evaluation is not "parentheses" first so much but a pattern recognition of the reader. How does he/she/they interpret what is written on the expression.


The main problem is the machine interpretation to a standard mathematical FORM with regard to 'implied' functions.

 


And as this topic is about dodgy SCI calculators not applying the proper FORM solutions to algebraic formula entries... So to the real point it is when choosing a SCI calculator the explicit warning 'caveat emptor' applies!



Also there is only one solution to this equation...

6/2(2+1) = 1

or

\$\frac{6}{2(2+1)}\$ = 1

... and is a good test for when buying a real SCI calculator!

QED
« Last Edit: June 23, 2022, 05:30:22 am by Scherms »
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11859
  • Country: us
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #38 on: June 23, 2022, 07:02:22 am »
Same with the -1² = -1 (as I have understood that it is now somewhat standard form in printed math)

I think there was at some point an attempt to separate the negative sign from the minus operator in typography, so that you could write, for example, 1 − -1 = 2

But it seems this did not get much traction.
 

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #39 on: June 23, 2022, 07:50:01 am »
« Last Edit: June 23, 2022, 08:25:11 am by Scherms »
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23018
  • Country: gb
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #40 on: June 23, 2022, 07:55:21 am »
Did some tests on my daughter's Casio FX-CG50 and I'm quite impressed.

So I entered the usual test case here verbatim. When you hit EXE it actually shows what its interpretation of the input is in the input line by adding parenthesis where it made assumptions for you to validate



Of course being natural input it allows much less ambiguous entry method so it should be represented as this really:



I rather like this. Also does engineering units with SI multiplier suffixes:

 
The following users thanked this post: Scherms

Offline Vtile

  • Super Contributor
  • ***
  • Posts: 1144
  • Country: fi
  • Ingineer
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #41 on: June 23, 2022, 08:04:45 am »
Same with the -1² = -1 (as I have understood that it is now somewhat standard form in printed math)

I think there was at some point an attempt to separate the negative sign from the minus operator in typography, so that you could write, for example, 1 − -1 = 2

But it seems this did not get much traction.
Honestly the typographical "solution" is just stupid (I have a stronger adjective in my head, but as this is family friendly environment "stupid" shall be sufficient). None will ever want to judge something like that, based on subtle differences in vertical line length and variation of position.  |O
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23018
  • Country: gb
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #42 on: June 23, 2022, 08:06:56 am »
Typographical solution is fine. Been using it for over 40 years on paper :)
 
The following users thanked this post: Vtile, Scherms

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #43 on: June 23, 2022, 08:46:00 am »
Typographical solution is fine. Been using it for over 40 years on paper :)

I've been using my HP-41CX for 34+ years...
...before that a K&E Keuffel & Esser DECI-LON 68 1100 Slide Rule





 8)
« Last Edit: June 23, 2022, 09:13:11 am by Scherms »
 
The following users thanked this post: bd139

Offline Vtile

  • Super Contributor
  • ***
  • Posts: 1144
  • Country: fi
  • Ingineer
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #44 on: June 23, 2022, 01:39:15 pm »
Typographical solution is fine. Been using it for over 40 years on paper :)
As long you can chose the typeset.... as in paper and pen.
 

Offline wizard69

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: us
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #45 on: June 25, 2022, 06:11:12 am »
The HP prime in Textbook entry mode gives the answer correctly as 1.
In Algebraic entry mode gives the answer 9.


The question is which is correct.   Is there some sort of science based calculation, that is a calculation that can be verified against physical evidence that one is correct over the other.   The reason I ask (mind your this was 45 years ago, we where taught that expressions in parens get evaluated first and then it is left to right respecting operator precedence.   At least that is the way I remember it, though the DaveCalc explanation made some sense if the operator to the left was addition or subtraction.

It would make for an interesting discussion if we could find an example from science or geometry where one of these two orderings is completely wrong.   It just seems odd that the reset of the world is doing it wrong.   It is interesting that a calculator like Qalculate! offers three ways to evaluate the expression when I typed it in.   I just can't see any reasoning where implicit multiplication with a set of parens returning a value would take precedence over the rest of the evaluation.   In the end that is what I see, the parens are effectively a function that returns a value to be plugged into the equation. 
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11859
  • Country: us
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #46 on: June 25, 2022, 08:10:06 am »
The question is which is correct.

There isn't a correct answer. It isn't a test, or a puzzle, it is rather an attempt at communication. If there can be disagreement about what is being communicated, then the communication has failed. In that case, all answers are wrong.
 

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #47 on: June 26, 2022, 03:34:12 am »
The question is which is correct.

There isn't a correct answer...
...all answers are wrong.

I'm a chemical engineer --


NOPE!  Not in this case... make up your mind you hypocrite!



...in the real world of mathematics and engineering, adjacent terms bind more tightly than operators. Therefore a/bc is understood to be \$\frac{a}{bc}\$

Similarly, 6/2(2+1) would be read as \$\frac{6}{2(2+1)}\$

Yes, there is only one FORM solution to this equation...

6/2(2+1) would be read as \$\frac{6}{2(2+1)}\$ = [6 / [2 x [2 + 1]]] = 1


... and is a good test for when buying an accurate SCI calculator!
« Last Edit: June 26, 2022, 07:31:27 am by Scherms »
 

Offline Scherms

  • Regular Contributor
  • *
  • Posts: 57
  • Country: au
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #48 on: June 26, 2022, 01:18:41 pm »
Just to be clear...



Even old HP calcs 40 years old won't allow implicit syntax to be entered!

 :clap:
« Last Edit: June 26, 2022, 01:36:28 pm by Scherms »
 
The following users thanked this post: bd139

Offline wizard69

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: us
Re: EEVblog 1479 - Is Your Calculator WRONG?
« Reply #49 on: June 27, 2022, 03:37:34 pm »
The question is which is correct.

There isn't a correct answer...
...all answers are wrong.

I'm a chemical engineer --


NOPE!  Not in this case... make up your mind you hypocrite!



...in the real world of mathematics and engineering, adjacent terms bind more tightly than operators. Therefore a/bc is understood to be \$\frac{a}{bc}\$

Similarly, 6/2(2+1) would be read as \$\frac{6}{2(2+1)}\$

Yes, there is only one FORM solution to this equation...

6/2(2+1) would be read as \$\frac{6}{2(2+1)}\$ = [6 / [2 x [2 + 1]]] = 1


... and is a good test for when buying an accurate SCI calculator!

I'm still up in the air here, I was always told to evaluate left to right respecting precedence.   Thus that would read as "six half times 3" or 3 * 3.   This would be the result of solving calculations within the parens and then restarting left to right.  I just find it amazing that half the world sees this differently.

This leaves me wondering how much screwed up software is out there.
 
The following users thanked this post: Scherms


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf