Re: math:gcd is incorrect

new topic     » goto parent     » topic index » view thread      » older message » newer message
bill said...

The manual:

62.7.7 GCD
Any zero parameter causes 0 to be returned.
This is simply wrong.

GCD (0, 48) = 48

Agreed. GCD(0, 48) is the same as GCD(48, 0) which is 48.

I'll take a stab at fixing this.

bill said...

(and 1/0 != INF).

Agreed. The limit of 1/x becomes arbiturarily large as x approaches 0, but that's different from stating that 1/0 is equal to infinity.

bill said...

Division by 0 is undefined

Except in trivial rings and wheel groups...

bill said...

Note: formally gcd(0, 0) is undefined and should be an
error just as much as division by zero is an error.

Technically, this is correct. Sometimes GCD(0, 0) is explicitly considered being equal to zero for similiar reasons that 0^0 is considered equal to 1.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu