Should old Henry catch a herring trawling off America or Sir Olivers horse came ambling home to Olivers aunt.CIVIL and SOHCAHTOA were taught in the early 60's and never to be forgotten, along with my 'non-military' works numbers
Should old Henry catch a herring trawling off America or Sir Olivers horse came ambling home to Olivers aunt.CIVIL and SOHCAHTOA were taught in the early 60's and never to be forgotten, along with my 'non-military' works numbers
If the desired order of operations is not completely and explicitly defined within the expression (by use of adequate parentheses), then there is no alternative other than to rely on some strict and consistent convention such as BODMAS.And if you believe in BODMAS then watch this for a mind blower
Possibly APL - can't remember how that deals (if it does) with parentheses. If it ignores them the answer would be 5.There may well be exceptions of which I'm not aware
They wouldn't have parentheses.(and I'm not counting languages which require Reverse Polish notation for expressions)
Indeed.They wouldn't have parentheses. .... 6 2 ÷ 1 2 + x
The first computer I built, around 1980, used RPN, because it used an available RPN calculator chip as a 'maths co-processor' (to avoid me having to try to programme all the maths functionality, in machine code, within an 8 kB memory limitI've got a calculator which uses RPN - it never goes well lending it to someone.
That's certainly always been my understanding as to how/why RPN arose.Ah yes, RPN - wonderful stuff and you can so things that look a bit like entries for an obfuscated C contestI imagine it's also much easier to program an interpreter for since the order of operations is completely explicit and execution is "just" a matter of popping things on/off a stack.
It's a long time since I last had to think about this, but doesn't that mean:6 2 1 2 + x ÷
No - it means 6 ÷ (2 x (1 + 2)).It's a long time since I last had to think about this, but doesn't that mean:
(1+2) x 2 ÷ 6 (= 1)
I posted what you'd get as input to your RPN engine if the human being doing the conversion to RPN interpreted 6÷2(1+2) the "other way". RPN may have no ambiguities or uncertainties about interpretation but that doesn't mean that there aren't potentially some in the pre-RPN stage.In most senses, it's really just a matter as the human being have done all 'interpreting' (of however he/she might otherwise write the expression) before talking to the machine.
Ah, there clearly is more dust in my memory than I thought! As you will realise, I was thinking that when one put several operators after several operands in that fashion, that the operands would be dealt with in reverse order.No - it means 6 ÷ (2 x (1 + 2)).
Yes, once one has corrected my faulty memory as above, that all makes sense.It's the "other answer" to the expression in the video, as described in it, according to the conventions of 100 years ago. .... I posted what you'd get as input to your RPN engine if the human being doing the conversion to RPN interpreted 6÷2(1+2) the "other way".
There may well be exceptions of which I'm not aware (and I'm not counting languages which require Reverse Polish notation for expressions), but I am not personally aware of any computer language which would not give the (present-day) BODMAS-correct result (9) for the expression discussed in that video
I've just dug out some extremely dusty notes I made (longer ago than I care to think about) regarding APL.Possibly APL - can't remember how that deals (if it does) with parentheses. If it ignores them the answer would be 5.
That would be a very strange 'expansion'!How about 6÷2(1+2) expanded becomes 6÷2+4 ....
If you need to find a tradesperson to get your job done, please try our local search below, or if you are doing it yourself you can find suppliers local to you.
Select the supplier or trade you require, enter your location to begin your search.
Are you a trade or supplier? You can create your listing free at DIYnot Local