December 9, 2014 at 10:09 pm
Comments posted to this topic are about the item Simple arithmetic
Don Simpson
December 10, 2014 at 12:22 am
Nice question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
December 10, 2014 at 3:04 am
This was removed by the editor as SPAM
December 10, 2014 at 3:38 am
i saw lots of people on social sites having problems with:
1+1+1+1+1+1+1+1+1+1+1+1x0+1 = ?
most of the answers was 1. So saying Simple may apply differently to others :hehe:
December 10, 2014 at 3:40 am
It's. Too. Early. For. This. 🙂
December 10, 2014 at 5:25 am
It was simple math, but also a simple exercise in clear thinking, something I would think that most people who work in databases would be good at. Thanks.
December 10, 2014 at 6:01 am
Emil Bialobrzeski (12/10/2014)
i saw lots of people on social sites having problems with:1+1+1+1+1+1+1+1+1+1+1+1x0+1 = ?
most of the answers was 1. So saying Simple may apply differently to others :hehe:
Slightly unfair question, though, because the answer depends on operator precedence. For instance, I was never taught at school that multiplication takes priority over addition, and if you just process that statement left to right, then the answer *is* 1--you add a load of 1s together, multiply that by zero, and add 1 to the result.
December 10, 2014 at 6:08 am
paul.knibbs (12/10/2014)
Emil Bialobrzeski (12/10/2014)
i saw lots of people on social sites having problems with:1+1+1+1+1+1+1+1+1+1+1+1x0+1 = ?
most of the answers was 1. So saying Simple may apply differently to others :hehe:
Slightly unfair question, though, because the answer depends on operator precedence. For instance, I was never taught at school that multiplication takes priority over addition, and if you just process that statement left to right, then the answer *is* 1--you add a load of 1s together, multiply that by zero, and add 1 to the result.
++1
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
December 10, 2014 at 6:24 am
paul.knibbs (12/10/2014)
Emil Bialobrzeski (12/10/2014)
i saw lots of people on social sites having problems with:1+1+1+1+1+1+1+1+1+1+1+1x0+1 = ?
most of the answers was 1. So saying Simple may apply differently to others :hehe:
Slightly unfair question, though, because the answer depends on operator precedence. For instance, I was never taught at school that multiplication takes priority over addition, and if you just process that statement left to right, then the answer *is* 1--you add a load of 1s together, multiply that by zero, and add 1 to the result.
Wow, really? Proper order of operations is fairly important in most high level maths. I remember having drills wherein we had to take math expressions and add parentheses to show how the statement should be parsed.
December 10, 2014 at 6:41 am
Xavon (12/10/2014)
paul.knibbs (12/10/2014)
Emil Bialobrzeski (12/10/2014)
i saw lots of people on social sites having problems with:1+1+1+1+1+1+1+1+1+1+1+1x0+1 = ?
most of the answers was 1. So saying Simple may apply differently to others :hehe:
Slightly unfair question, though, because the answer depends on operator precedence. For instance, I was never taught at school that multiplication takes priority over addition, and if you just process that statement left to right, then the answer *is* 1--you add a load of 1s together, multiply that by zero, and add 1 to the result.
Wow, really? Proper order of operations is fairly important in most high level maths. I remember having drills wherein we had to take math expressions and add parentheses to show how the statement should be parsed.
Order of operations is an arbitrary syntax decision, and not necessarily implemented consistently in programming languages. Yes there is a standard in mathematics but it could easily have been different. It could have been that there was no decision at all and that the only way to guarantee order was with parentheses. Luckily parentheses are given priority, at least in every language I've come across. Doesn't hurt to add them in anyway, otherwise questions like that are just syntax memory tests rather than logic tests.
back to the real topic. I enjoyed the question. I suppose that depending on the underlying implementation, it could save a little memory 🙂
December 10, 2014 at 6:48 am
Nice math swap. Now is there something like that for strings?
December 10, 2014 at 7:02 am
Nice but simple question: I'm wondering why it worths 2 points
December 10, 2014 at 7:06 am
Hany Helmy (12/10/2014)
paul.knibbs (12/10/2014)
Emil Bialobrzeski (12/10/2014)
i saw lots of people on social sites having problems with:1+1+1+1+1+1+1+1+1+1+1+1x0+1 = ?
most of the answers was 1. So saying Simple may apply differently to others :hehe:
Slightly unfair question, though, because the answer depends on operator precedence. For instance, I was never taught at school that multiplication takes priority over addition, and if you just process that statement left to right, then the answer *is* 1--you add a load of 1s together, multiply that by zero, and add 1 to the result.
++1
I think you need a refund on your base math education. BEDMAS was drilled into us here in the Great White North starting at age 10 (Grade 5), and continued through to end of Math in high school.
Since BEDMAS might be unknown
B - Brackets
E - Exponents
DM - Division / Multiplication
AS - Addition / Subtraction
December 10, 2014 at 7:35 am
Xavon (12/10/2014)
paul.knibbs (12/10/2014)
Emil Bialobrzeski (12/10/2014)
i saw lots of people on social sites having problems with:1+1+1+1+1+1+1+1+1+1+1+1x0+1 = ?
most of the answers was 1. So saying Simple may apply differently to others :hehe:
Slightly unfair question, though, because the answer depends on operator precedence. For instance, I was never taught at school that multiplication takes priority over addition, and if you just process that statement left to right, then the answer *is* 1--you add a load of 1s together, multiply that by zero, and add 1 to the result.
Wow, really? Proper order of operations is fairly important in most high level maths. I remember having drills wherein we had to take math expressions and add parentheses to show how the statement should be parsed.
Yes, operator precedence is very important. That's why both computer languages and mathematical calculi and notations define operator precedence rigorously. There are pleny of languages/calculi where precedence is defined to be purely left to right except unless there are special cases like for example the use of brackets or some other precedence modifying syntax (eg in mathematics the lambda calculus and some of its derivatives, and in computing several programming languages based on them) and also notations where precedence is purely left to right or purely right to left - think of Polish notation and reverse Polish notation, which are respectively left to right and right to left: both are commonly used in both maths and computing. Given the expression 1+1x0+1 the value could be 3,1, or 2 depending on the precedence rules so unless either the language/notation is specified or the precedence rules are defined without mentioning the language/notation there's no knowing what the value is. Sure, in a junior high school maths test the answer will probably be 2 because no-one has yet been taught that there's more than one possible notation, but that doesn't mean that that's always the right answer.
Tom
December 10, 2014 at 7:37 am
davoscollective (12/10/2014)
Xavon (12/10/2014)
paul.knibbs (12/10/2014)
Emil Bialobrzeski (12/10/2014)
i saw lots of people on social sites having problems with:1+1+1+1+1+1+1+1+1+1+1+1x0+1 = ?
most of the answers was 1. So saying Simple may apply differently to others :hehe:
Slightly unfair question, though, because the answer depends on operator precedence. For instance, I was never taught at school that multiplication takes priority over addition, and if you just process that statement left to right, then the answer *is* 1--you add a load of 1s together, multiply that by zero, and add 1 to the result.
Wow, really? Proper order of operations is fairly important in most high level maths. I remember having drills wherein we had to take math expressions and add parentheses to show how the statement should be parsed.
Order of operations is an arbitrary syntax decision, and not necessarily implemented consistently in programming languages. Yes there is a standard in mathematics but it could easily have been different. It could have been that there was no decision at all and that the only way to guarantee order was with parentheses. Luckily parentheses are given priority, at least in every language I've come across. Doesn't hurt to add them in anyway, otherwise questions like that are just syntax memory tests rather than logic tests.
back to the real topic. I enjoyed the question. I suppose that depending on the underlying implementation, it could save a little memory 🙂
Can you show me an example of any programming language that does not support the mathematical agreed upon order of operations?
The question above is NOT a syntax memory test, it tests your understanding of the order of operations for math.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 15 posts - 1 through 15 (of 30 total)
You must be logged in to reply to this topic. Login to reply