Live data from Hacker News

1/0 = 0 (2018)

hillelwayne.com

51–60 of 245 posts

Re: 1/0 = 0 (2018)

#51
In the computational domain we hold entropy in high esteem. Arbitrarily assigning a value of 0 does not preserve entropy. We could return a promise that eventually we will not overflow if we get to be very very clever (arbitrary time) so that we can maintain purity.

Re: 1/0 = 0 (2018)

#52
post #35
post #30

Whatever as long as the name does not imply that these are integers, because then it is just wrong. The same holds for overflowing results being clamped or resulting in smaller or negative values due to wraparound. These are not integers. There is only one correct behavior for something named "int". Give the correct result or throw an error.

Those are all integers. https://en.wikipedia.org/wiki/Modular_arithmetic - "The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book Disquisitiones Arithmeticae, published in 1801." They have been integers for over 200 years now.

But if you write a + b and the result is wrapped around or saturated, it's not integer addition. It's something else and should be written in another way in code and have a different name. I am aware of modular arithmetic.

If you have a type named "int" with an operation called "addition", and that operation is not actually integer addition... it's wrong.

Re: 1/0 = 0 (2018)

#53
post #28

Earlier quoted context omitted.

I am not familiar with any "magical other undefined Zero". Please familiarize me :-) What is your, uh, definition of this undefined* number you are familiar with?

> Every element EXCEPT 0 has a multiplicative inverse, a⁻, such that a*a⁻ = 1. What is "0"? It's not defined in the axioms other than additive zero. Or is it multiplicative zero? (1?). Is it the number zero? If it is the additive zero defined in axiom (3), then it just seems weird to me that additive zero is undefined for multiplicative inverse for all fields always and forever. If it is the number zero, then how doe…

"Zero" is just a specific element of the field which satisfies being the additive identity as well as the rest of the properties of a field where 0 is mentioned. When the rest of the axioms refer to "zero" they refer to the exact same element of the set that is also the additive identity.

It's not the "number zero" because a field does not care about numbers, it's just elements of a set (which might be numbers like in R's case).

1 is not "multiplicative zero", it's the "multiplicative identity".

0 and 1 are just the shorthand we give for those elements. because those are the symbols we use in R which is the most common field we deal with in everyday life.

Or am I misunderstanding your question?

Re: 1/0 = 0 (2018)

#54
post #48
post #26

Earlier quoted context omitted.

Reusing symbols like +, *, or / to define operations that aren't the + or the / you're used to is pretty common in math. It's just notation. At the end of the day, the / that we have in programming has the same problem as this article's /, almost all programming languages will return 5/2 = 2 when dividing integers, even though 2 * 2 is not 5! Division is not defined for all integers, but it's just convenient to exten…

That's nonsense. a/b is float in Python 3, and even in other languages a/b gets closer to it's actual value as a and b get bigger (the "limit", which is the basis of Algebra). So four operations in programming generally do agree with foundations of Algebra. But a/0=0 is %100 against Algebra. And it's very unintuitive. It's basically saying zero is the same as infinity, and therefore all numbers are the same, so why b…

> even in other languages a/b gets closer to it's actual value as a and b get bigger (the "limit", which is the basis of Algebra)

This is not generally true. 5/2 = 2, 50/20 = 2, 500/200 = 2, and so on no matter how big the numbers get.

Re: 1/0 = 0 (2018)

#55

I've always wondered what would happen if we defined /0 as a new symbol, for example 'z'. The same as we define sqrt(-1) as 'i'. So if you can do 4*sqrt(-1)=4i, you could also do 4/0 = 4z. These two seems similar, as in taking something that should not exist, and just letting it exists in a totally different and orthogonal domain. I tried once to investigate the implications, but it quickly became far more complex th…

[deleted]

Re: 1/0 = 0 (2018)

#56
post #24
post #10

Earlier quoted context omitted.

I was also looking for this. And would like to add: lim(-1/x)_x -> 0 = -inf That is (in my opinion) the whole point why it is actually undefined. On one side of the y-axis it goes to infinity, on the other to minus infinity. I don't see a solution to this and therefore always have accepted that it is undefined.

No. 1/x^2 is undefined at 0 but has the same limit behavior , because limit behavior is not a function from "pairs of (functions from R to R, R)" to R Infinity is not a real number.

Can limit behavior be defined as Cauchy sequences?

Re: 1/0 = 0 (2018)

#57
post #53

Earlier quoted context omitted.

> Every element EXCEPT 0 has a multiplicative inverse, a⁻, such that a*a⁻ = 1. What is "0"? It's not defined in the axioms other than additive zero. Or is it multiplicative zero? (1?). Is it the number zero? If it is the additive zero defined in axiom (3), then it just seems weird to me that additive zero is undefined for multiplicative inverse for all fields always and forever. If it is the number zero, then how doe…

"Zero" is just a specific element of the field which satisfies being the additive identity as well as the rest of the properties of a field where 0 is mentioned. When the rest of the axioms refer to "zero" they refer to the exact same element of the set that is also the additive identity. It's not the "number zero" because a field does not care about numbers, it's just elements of a set (which might be numbers like i…

Nope that's the answer. Additive zero is the only zero.

Re: 1/0 = 0 (2018)

#58
post #48
post #26

Earlier quoted context omitted.

Reusing symbols like +, *, or / to define operations that aren't the + or the / you're used to is pretty common in math. It's just notation. At the end of the day, the / that we have in programming has the same problem as this article's /, almost all programming languages will return 5/2 = 2 when dividing integers, even though 2 * 2 is not 5! Division is not defined for all integers, but it's just convenient to exten…

That's nonsense. a/b is float in Python 3, and even in other languages a/b gets closer to it's actual value as a and b get bigger (the "limit", which is the basis of Algebra). So four operations in programming generally do agree with foundations of Algebra. But a/0=0 is %100 against Algebra. And it's very unintuitive. It's basically saying zero is the same as infinity, and therefore all numbers are the same, so why b…

Floats don't have multiplicative inverses, and the floating point operations don't give us any of the mathematical structures we expect of numbers. Floating point division already abandons algebra for the sake of usefulness.

Re: 1/0 = 0 (2018)

#59
post #28

Earlier quoted context omitted.

I am not familiar with any "magical other undefined Zero". Please familiarize me :-) What is your, uh, definition of this undefined* number you are familiar with?

> Every element EXCEPT 0 has a multiplicative inverse, a⁻, such that a*a⁻ = 1. What is "0"? It's not defined in the axioms other than additive zero. Or is it multiplicative zero? (1?). Is it the number zero? If it is the additive zero defined in axiom (3), then it just seems weird to me that additive zero is undefined for multiplicative inverse for all fields always and forever. If it is the number zero, then how doe…

The definition is that it is the additive identity for the field; eg x + a = x no matter what value x takes and what field you are considering. This must be unique; suppose a and b are both additive identities for a field, then b + a = b and a + b = a, but commutativity gives us a + b = b + a, resulting in a = b.

The reason the additive identity cannot have a multiplicative inverse is likewise fairly straightforward: once again using `a` as our additive identity we have y.(x+a) = y.x for all x, y in our field; distributing on the LHS gives y.x + y.a = y.x for all x, y in our field; subtracting y.x from both sides finally gives us y.a = 0 for all y in our field.

You would need to relax one or more of the field axioms to have a structure in which the additive identity can have a multiplicative inverse. I'm not aware of any algebraic structure of particular interest that would allow a multiplicative inverse of the additive identity, but in general if you're interested in reading more on this sort of thing I'd recommend reading about rings, commutative rings, and division algebras.

Re: 1/0 = 0 (2018)

#60
So, how often do devs actually want a `/` that isn't the inverse of multiplication?

Trying to calculate... I don't know, how many 2-disk raid6 groups I need to hold some amount of data is an error, not "lol you don't need any".

If my queue consumer can handle 0 concurrent tasks, it will take literally forever to finish, not finish instantly.

Post reply on HN