Live data from Hacker News

1/0 = 0

hillelwayne.com

401–410 of 593 posts

Re: 1/0 = 0

#401
To be honest, this is the kind of post I'd write after a few beers when I'm not giving a shit and I think people have the right idea about something a lot of people would find controversial. Great post! You've made a real contribution here.

Re: 1/0 = 0

#402

Earlier quoted context omitted.

My comment from when this came up on Reddit, slightly edited for context: `/`-by-0 is just an operation and it tautologically has the semantics assigned to it. The question is whether the specific behaviour will cause bugs, and on glance that doesn't sound like it would be the case. Principally, division is normally (best guess) used in cases where the divisor obviously cannot be zero; cases like division by constant…

What happens for 0 / 0? Is this also 0?

inf 0

Re: 1/0 = 0

#403

Earlier quoted context omitted.

> He refutes them by asserting that the multiplicative inverse doesn't exist. Yes - but in algebraic fields division by x is equivalent to multiplication by 1/ x . This is precisely why you cannot have a field that admits division by 0: because 0 has no multiplicative inverse.

Maybe all this talk about fields is a distraction? Integer arithmetic isn't a field anyway. Other than 1 and -1, no integer has a multiplicative inverse that's an integer. Integer division just isn't the same operation as division on rationals or reals. The same laws don't apply. (For floats, division by zero can return Inf, -Inf or NaN and there's no reason to define it differently.) It looks like the theorem-provin…

Yes! Exactly, it's a distraction. There are reasonable, well-intentioned reasons to argue that division by 0 should be an acceptable operation in a computational setting. Computational settings need not admit all the rigor of theoretical math. I wish the author had not tried to involve field theory and programming like this because it detracts from the point :)

Re: 1/0 = 0

#404
post #254
post #243

Earlier quoted context omitted.

You are correct. But it really should be NaN, since 1/ε is positive infinity, whereas 1/-ε is negative infinity. Oh well :)

JS just assumes the limit direction for you, so 1/0 is Infinity, but -1/0 is -Infinity. 0/0 at least is correctly NaN. (Edit: And I just verified against my memory, Matlab (or at least Octave) does the same thing. While Matlab might get characterized as being for the ivory tower, at least it's had a long history of being used for practical math applications within the tower. Edit2: And anyway this is the defined beha…

Moreover, 1/-0 is -Infinity. IEEE float has two zeros, positive and negative.

Re: 1/0 = 0

#405

Hi, I'm on the Pony core team. I will be writing in more detail about this decision. A few short notes until then: 1) no one on the team has ever been happy with ending up here, understanding why the decision was made involved understand how partial functions (one that can produce errors like division by zero) are handled in Pony and interesting ergonomic issues that can result that is a large part of what my post wi…

thanks for such a ginuwine response

Re: 1/0 = 0

#406

Earlier quoted context omitted.

My comment from when this came up on Reddit, slightly edited for context: `/`-by-0 is just an operation and it tautologically has the semantics assigned to it. The question is whether the specific behaviour will cause bugs, and on glance that doesn't sound like it would be the case. Principally, division is normally (best guess) used in cases where the divisor obviously cannot be zero; cases like division by constant…

What happens for 0 / 0? Is this also 0?

Is this the same as 0 * 1 / 0?

Re: 1/0 = 0

#407
post #243
post #208

Earlier quoted context omitted.

To clarify, in Javascript 1/0 is Infinity, not NaN.

You are correct. But it really should be NaN, since 1/ε is positive infinity, whereas 1/-ε is negative infinity. Oh well :)

e is nearly 0, -e is nearly -0.

So 1/0 is infinity, and 1/-0 is -infinity.

Re: 1/0 = 0

#408

Earlier quoted context omitted.

Hillel is talking about math. Unfortunately computers don't really do "math". For example, math doesn't have overflow and underflow to deal with. The floating point standard says that division by 0.0 should be Infinity and provides a value for it. The integer math, all possible values are used for numbers, so division by zero is undefined behavior. And from there, every language is potentially going to have a mess of…

Integers are perfectly fine in math. But they are not a field. Integers modulo something are also well understood in math - but again not a field.

Integers modulo any prime are a field.

Re: 1/0 = 0

#409

My math is rusty but 1 / 0 := 0 implies that 0 * 0 := 1. This contradicts the definition of a binary field [1], let alone a field of real numbers. [1] https://en.wikipedia.org/wiki/GF(2) > "It is totally fine to define 1/0 = 0." No, it's not, at least not useful. If you define it that way, you will not have a field . Then you don't have +, -, *, and / operations with the commonly assumed behavior. However, it is defi…

> However, it is definitely possible to define some operation such that 1 `op` 0 := 0, just not the inverse operation of multiplication. If you read the post this is actually exactly what the OP is saying.

Sure, the author spent a long blog essay and didn't get the point across as clearly as many of the comments here on HN. If this were to be a research paper it would likely get rejected without a review. Not to mention the whole point of the idea is trivial. Why reinvent a wheel that traps everyone into the author's whimsical thinking when there is a standard way of doing this thing (1 / 0 => raise ZeroDivisionError)?

I, for one, will respectfully decline to use any programming language that defines 1/0 to be 0.

Re: 1/0 = 0

#410

Earlier quoted context omitted.

I think OP means that nothing breaks mathematically. It is not inconsistent and not false, so you can work with it. The only issue is to deal specially with the case of division by zero, which you have to do anyways. Code that assumes that (x/y) * y = x is wrong if you don't check for y = 0, independently of what you define x/0 to be.

You do realize that division is the inverse operation of multiplication, right? Like subtraction is the inverse of addition. By defining addition we define subtraction. By defining multiplication we define division. This is where the author fails. Division is multiplication of a fractional value. This is VERY important. And just because it is mathematically a field does not mean it is particularly the right choice. A…

Bravo, that's a great explanation. I think you've done a better job here than my comments elsewhere in this thread. Nice tie in to dimensionality, the complexes and quaternions too.

There are legitimate reasons to advocate for defining division by 0 in the context of a programming language. But the attempt at mathematical rigor really distracts from those reasons. It feels like the author made a decision and reached for some odd mathematics that seems to support it but doesn't. Floating numbers don't even form a field. If we define division by 0 in a field it stops being a field and becomes a ring or some sort of weird finite field with a single element...

Post reply on HN