Live data from Hacker News

One in five genetics papers contains errors thanks to Excel (2016)

science.org

61–70 of 267 posts

Re: One in five genetics papers contains errors thanks to Excel (2016)

#61
post #55

An annoyance with spreadsheets that deterred me from ever using them in teaching is that they've perpetuated a arithmetic order-of-precedence bug. ("Bug" in the sense that it contradicts long-standing mathematical convention.) If you type -3^2 in a cell and press ENTER, the spreadsheet tell you it's "9". It should be "-9"; in math, exponentiation has precedence over unary minus, so you square 3, then negate the resul…

But it's 9! Check it: https://www.mathplanet.com/education/pre-algebra/explore-and... . "You also have to pay attention to the signs when you multiply and divide. There are two simple rules to remember: When you multiply a negative number by a positive number then the product is always negative. When you multiply two negative numbers or two positive numbers then the product is always positive." So basically you have…

No - in a subtle way, you're assuming that the unary minus has precedence, when the point is that it doesn't.

You're right that "thing^2" means "thing times thing", but in "-3^2", what is it that is being squared? To write it, as you did, as "(-3) x (-3)", assumes that in "-3^2" the thing being squared is "-3". But that in turn assumes that the unary minus is done before the square. By the standard mathematical convention, in "-3^2" the thing being squared is "3". So you do "3 * 3", then you negate the result and get "-9".

Re: One in five genetics papers contains errors thanks to Excel (2016)

#63
post #58
post #55

Earlier quoted context omitted.

But it's 9! Check it: https://www.mathplanet.com/education/pre-algebra/explore-and... . "You also have to pay attention to the signs when you multiply and divide. There are two simple rules to remember: When you multiply a negative number by a positive number then the product is always negative. When you multiply two negative numbers or two positive numbers then the product is always positive." So basically you have…

https://www.wolframalpha.com/input?i=-3%5E2 https://en.wikipedia.org/wiki/Order_of_operations Parentheses, Exponentiation, Multiplication, Division, Addition, Subtraction -3^2 would then be correctly parsed as -(3^2) which is -9. Parsing it as (-3)^2 would require the addition of parentheses. This gets to the special case of the unary minus sign... which the Wikipedia article specifically calls out. Special cases Una…

Fortunately these rules are natural and easy to remember, especially the details of how different languages choose different orders, relative to the confusing and abhorrent prefix notation (- (^ 3 2)) or (^ (- 3) 2).

Re: One in five genetics papers contains errors thanks to Excel (2016)

#64

The problem with Excel is that it tries to do almost everything in one software tool: front-end (editing, presentation), analysis, semantic modeling, data storage/database. Almost all reasonable engineers see that there is something wrong with such an approach. But almost all everyday computer users think that this is the way computing has to be. Sometimes I wonder why even I voluntarily open it for certain tasks - a…

Except that it's proprietary and will eventually be un-maintained and stop working. But spreadsheets, in general, fall under the Lindy effect and open source software will continue it for centuries to come.

Although excel spreadsheets have had more longevity than lots of other formats…

Re: One in five genetics papers contains errors thanks to Excel (2016)

#65

An annoyance with spreadsheets that deterred me from ever using them in teaching is that they've perpetuated a arithmetic order-of-precedence bug. ("Bug" in the sense that it contradicts long-standing mathematical convention.) If you type -3^2 in a cell and press ENTER, the spreadsheet tell you it's "9". It should be "-9"; in math, exponentiation has precedence over unary minus, so you square 3, then negate the resul…

I had a discussion on one of the Nim boards because Nim does the same, i.e. Writing -2^2=4 but 0-2^2=-4 because Nim treats the first as the unary - which takes precedence over exponentiation. I realise that you can argue how it is technically correct (and interestingly several of the people I was talking with couldn't even get my point), but I still argue it's incredibly unintuitive for anyone coming from an regular engineering/science background who wants to do regular work. I would almost argue will exclude it to be used by many due to this.

Re: One in five genetics papers contains errors thanks to Excel (2016)

#66
post #58
post #55

Earlier quoted context omitted.

But it's 9! Check it: https://www.mathplanet.com/education/pre-algebra/explore-and... . "You also have to pay attention to the signs when you multiply and divide. There are two simple rules to remember: When you multiply a negative number by a positive number then the product is always negative. When you multiply two negative numbers or two positive numbers then the product is always positive." So basically you have…

https://www.wolframalpha.com/input?i=-3%5E2 https://en.wikipedia.org/wiki/Order_of_operations Parentheses, Exponentiation, Multiplication, Division, Addition, Subtraction -3^2 would then be correctly parsed as -(3^2) which is -9. Parsing it as (-3)^2 would require the addition of parentheses. This gets to the special case of the unary minus sign... which the Wikipedia article specifically calls out. Special cases Una…

Thanks for looking all this up, particularly the stuff about spreadsheets. I wonder what real early spreadsheets like Lotus 1-2-3 or even Visicalc would do with "-3^2". I have to feel one of the early spreadsheet programmers just made a mistake, because I can't think of a practical reason for going against the mathematical convention if they were already aware of it. Or maybe it comes from bc? ... does bc predate modern spreadsheets?

(Well, I just tried "=-3^2" in an org-mode table and it gives "-9".)

Re: One in five genetics papers contains errors thanks to Excel (2016)

#68
post #58

Earlier quoted context omitted.

https://www.wolframalpha.com/input?i=-3%5E2 https://en.wikipedia.org/wiki/Order_of_operations Parentheses, Exponentiation, Multiplication, Division, Addition, Subtraction -3^2 would then be correctly parsed as -(3^2) which is -9. Parsing it as (-3)^2 would require the addition of parentheses. This gets to the special case of the unary minus sign... which the Wikipedia article specifically calls out. Special cases Una…

Fortunately these rules are natural and easy to remember, especially the details of how different languages choose different orders, relative to the confusing and abhorrent prefix notation (- (^ 3 2)) or (^ (- 3) 2).

As a lover of prefix and postfix notation, there is an unambiguous parsing of each of those that does not deepened on any order of operations. Neither lisp nor forth have the question at all - you can only write it exactly as you mean it.

    (- (expt 3 2))
is always -9 without needing to ask which has higher precedence.

    (expt -3 2)
is likewise always 9. There is no question if - is a binary or unary operator in prefix notation and what its order of operation should be.

Likewise, in dc

    3 _ 2 ^ p
    _3 2 ^ p
and

    3 2 ^ _ p
where '_' is the negation operator (it can be used for writing -3 directly as _3, but _ 3 is a parse error) return their results without any question of order of operations.

When you start touching infix, you get into https://en.wikipedia.org/wiki/Shunting_yard_algorithm which was not a fun part of my compiler class.

(And yes, I do recognize your credentials ... I still think that lisp and forth (above examples for dc) are better notational systems for working with computers even if it takes a bit of head wrapping for humans).

Re: One in five genetics papers contains errors thanks to Excel (2016)

#69
post #55

An annoyance with spreadsheets that deterred me from ever using them in teaching is that they've perpetuated a arithmetic order-of-precedence bug. ("Bug" in the sense that it contradicts long-standing mathematical convention.) If you type -3^2 in a cell and press ENTER, the spreadsheet tell you it's "9". It should be "-9"; in math, exponentiation has precedence over unary minus, so you square 3, then negate the resul…

But it's 9! Check it: https://www.mathplanet.com/education/pre-algebra/explore-and... . "You also have to pay attention to the signs when you multiply and divide. There are two simple rules to remember: When you multiply a negative number by a positive number then the product is always negative. When you multiply two negative numbers or two positive numbers then the product is always positive." So basically you have…

How we right negative literals in expressions is the issue. Nobody would seriously think -x^2 = -4 had no non-imaginary solutions. But if we swap out x for a literal number people start interpreting it ambiguously as maybe a negative number exponentiated, but fundamentally it’s the same syntax as before.

Re: One in five genetics papers contains errors thanks to Excel (2016)

#70

An annoyance with spreadsheets that deterred me from ever using them in teaching is that they've perpetuated a arithmetic order-of-precedence bug. ("Bug" in the sense that it contradicts long-standing mathematical convention.) If you type -3^2 in a cell and press ENTER, the spreadsheet tell you it's "9". It should be "-9"; in math, exponentiation has precedence over unary minus, so you square 3, then negate the resul…

I had a discussion on one of the Nim boards because Nim does the same, i.e. Writing -2^2=4 but 0-2^2=-4 because Nim treats the first as the unary - which takes precedence over exponentiation. I realise that you can argue how it is technically correct (and interestingly several of the people I was talking with couldn't even get my point), but I still argue it's incredibly unintuitive for anyone coming from an regular…

You're right that violating established mathematical convention can be a deal-killer for some kinds of adoption.

A few years ago I was reading the docs for a new programming language, thinking it might be useful in teaching. The docs were well-written and in a beautifully produced book. I got to the chapter on trig functions and discovered that they'd decided to make angles increase clockwise. And there was a graph of the sine function, with the graph below the x-axis from 0 to 180 degrees. And I sadly put the well-written beautifully-produced book on the shelf and haven't looked at it since.

I can see why people would think "angles increase clockwise" is more natural than the existing convention ("angles increase counterclockwise") - it's the way clocks do it, right? Yeah, it's just convention, but when the established convention has been around for at least a century or two and there are libraries full of books and papers which use it, "more natural" still isn't good enough reason to break with it. And it really wasn't necessary to do that for their project.

I'm sure people who do software can think of lots of conventions which may even suck but will never be replaced.

Post reply on HN