rust-num / num-traits

Numeric traits for generic mathematics in Rust
Apache License 2.0
731 stars 135 forks source link

Pow(0, 0) no longer returnes 1 #78

Closed meltinglava closed 6 years ago

meltinglava commented 6 years ago

Oddly rustc also prints 1 for 0⁰. Did not find a issue for it, nor anywhere that says that it should be like that. Did not even find a unit test for this case(in rustc). Might want to make an issue for rustc

cuviper commented 6 years ago

cc #77 for the cross-reference

Many other languages return 1: https://rosettacode.org/wiki/Zero_to_the_zero_power

I think we should leave the current behavior alone and just document this edge case. Since we can't even check for this case without adding Zero in a breaking change, returning 1 is a reasonable compromise with tons of precedent.

cuviper commented 6 years ago

Closing in favor of #79.