Live data from Hacker News

1/0 = 0 (2018)

hillelwayne.com

201–210 of 245 posts

Re: 1/0 = 0 (2018)

#201
post #8
post #3

As long as lim(1/x)_x->0 = inf, 1/0 = 0 doesn't make a whole lot of sense, mathematically speaking. I might be wrong but I don't think it was addressed in the article either.

It's fine. Infinity isn't a real number, so 1/x isn't continuous at 0, so it doesn't matter what the value of 1/0 is. All your open sets still behave the way you expect. Whether you choose "this function is undefined here" vs "it's impossible to ever reach the value of this function at this value, under any assumptions I'll ever care about" is purely a matter of convenience.

Well if you consider 1/z as a function of a complex coordinate it definitely makes a lot of sense to set it to infty. That identifies +infty and -infty if you restrict yourself to the real numbers.

Re: 1/0 = 0 (2018)

#202
post #147

Earlier quoted context omitted.

If you want to do all the work at the end, 'exceptions' do exactly that, too.

Throwing an exception in a function normally stops the rest of the work that function would do. That is not the case when using Inf and similar > const f = (x) => [x/2, x/0] undefined > f(10) [ 5, Infinity ]

I assert stopping immediately is much more practical. In many cases, you waste considerable amounts of processing power to reach a conclusion you often won't be able to use.

Re: 1/0 = 0 (2018)

#203

Earlier quoted context omitted.

i would not expect 1/0 to be zero. as you divide by smaller numbers, the quotient gets bigger, so i can't understand why someone would expect /0 to be zero.

If I have five apples and were to divide them among 0 people then nobody gets anything and I can eat them all, so the proper solution would be 5.

I agree wholeheartedly. I think the issue stems from 0 meaning both 0 of "something"/"a concept" and "nil."

If I have 5 apples and divide them in to 0 buckets of apples, that makes sense. If I have 5 apples and divide them into 0 buckets of tractor; that doesn't make sense.

Re: 1/0 = 0 (2018)

#205
Another version of this: P(A|B) is not defined for P(B)=0, but you can safely let P(A|B)P(B)=0 when P(B)=0. Half the time, these two terms appear as a pair anyway.

It's a version of "you can't divide by zero, but you can multiply the divisor on both sides of the equation and then use 0*a=0."

Re: 1/0 = 0 (2018)

#206
post #168
post #143

Earlier quoted context omitted.

Interestingly, RiscV goes with 1/0 = 0xFFFF_FFFF (in 32 bit mode). I guess that's slightly more of a warning than giving 0.

It also seems more mathematically appropriate because it is as close to the limit of the reciprocal as one can get with that representation. Now please allow me to duck before being struck by the tomatoes of mathematicians.

It's probably due to how division is implemented, by shifting the divisor and subtracting it from the remainder. Subtracting (0 Intel's 80186 produced a result like that in one special case, because of a missing check in the microcode. This could be called a bug or an optimization: the "AAM" instruction was only documented as dividing by 10, but in fact takes a divisor as part of its opcode (D4 0A = divide by 10, as listed in the documentation; D4 00 = divide by zero). The normal divide instruction - as well as AAM on all other x86 processors - check for zero and throw an exception.

RISC-V just doesn't bother doing that.

Re: 1/0 = 0 (2018)

#207
post #18

I debated this with my boss at my first programming job (this was 20+ years ago). He thought 1/0 should be 0 rather than an error because "that's what people expect". My argument was from mathematical definitions (the argument which this blog post picks apart). In retrospect, I see his point better - practical use trumps theory in most language design decisions. I haven't changed my mind but the reason has shifted mo…

1/0 = 0 is usually not a practical thing, it's to satisfy that the output of the division operator stays in the type and you don't want crashes (a "feature" of ponylang and gleam, e.g.). Its kind of a PL wonk thing. It's not at all a good idea for very important practical reasons as I outline in a reply to parent.

Funny you should mention gleam since it's a BEAM host language... surely they shouldn't fear crash management, right ?

Re: 1/0 = 0 (2018)

#208
post #18

I debated this with my boss at my first programming job (this was 20+ years ago). He thought 1/0 should be 0 rather than an error because "that's what people expect". My argument was from mathematical definitions (the argument which this blog post picks apart). In retrospect, I see his point better - practical use trumps theory in most language design decisions. I haven't changed my mind but the reason has shifted mo…

[deleted]

Re: 1/0 = 0 (2018)

#209

Earlier quoted context omitted.

> The article shows why 1/0=0 is mathematically sound It does not, because it is not. And the “real mathematicians” that he quotes aren’t supporting his case either, they’re just saying that there are cases where it’s convenient to pretend. If you look at the Wikipedia page for division by zero you may find “it is possible to define the result of division by zero in other ways, resulting in different number systems”:…

"Making up your own rules" is literally what mathematics is, though. Using that as a counterargument to using a specific set of axioms tells me you don't understand mathematics.

But adopting a rule that says 1/0 = 0 means you may also have to accept that 1 = 0*0.

Re: 1/0 = 0 (2018)

#210

Earlier quoted context omitted.

> The article shows why 1/0=0 is mathematically sound It does not, because it is not. And the “real mathematicians” that he quotes aren’t supporting his case either, they’re just saying that there are cases where it’s convenient to pretend. If you look at the Wikipedia page for division by zero you may find “it is possible to define the result of division by zero in other ways, resulting in different number systems”:…

"Making up your own rules" is literally what mathematics is, though. Using that as a counterargument to using a specific set of axioms tells me you don't understand mathematics.

>”Making up your own rules" is literally what mathematics is, though.

We don’t make up arbitrary rules, though. Well…so-called mathematicians who study systems with completely arbitrary rules are just jerking off. The rules that most mathematicians use are based on our intuitions about what can’t be proven but “has to be” true.

Post reply on HN