Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated documentation to note the pow(0, 0) case. #79

Merged
merged 2 commits into from
Aug 7, 2018
Merged

Updated documentation to note the pow(0, 0) case. #79

merged 2 commits into from
Aug 7, 2018

Conversation

meltinglava
Copy link

Ref #78

src/pow.rs Outdated
@@ -173,13 +173,16 @@ mod float_impls {

/// Raises a value to the power of exp, using exponentiation by squaring.
///
/// Note that `0⁰` (`pow(0, 0)`) returnes `1`. Mathematicly this is undefined.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling: should be "mathematically"

src/pow.rs Outdated
@@ -208,6 +211,8 @@ pub fn pow<T: Clone + One + Mul<T, Output = T>>(mut base: T, mut exp: usize) ->

/// Raises a value to the power of exp, returning `None` if an overflow occurred.
///
/// Note that `0⁰` (`checked_pow(0, 0)`) returnes `Some(1)`. Mathematicly this is undefined.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*mathematically

@hauleth
Copy link
Member

hauleth commented Aug 6, 2018

Quoting prof Knuth:

On the other hand, Cauchy had good reason to consider 0^0 as an undefined limiting form, in the sense that the limiting value of f(x)^g(x) is not known a priori when f(x) and g(x) approach 0 independently. In this much stronger sense, the value of 0^0 is less defined than, say, the value of 0 + 0. Both Cauchy and Libri were right, but Libri and his defenders did not understand why truth was on their side.

https://arxiv.org/abs/math/9205211

@cuviper
Copy link
Member

cuviper commented Aug 7, 2018

@hauleth It's not clear to me if you're quoting that in favor or against, or just representing the debate.

Anyway, commenting the existing behavior is harmless.

bors r+

bors bot added a commit that referenced this pull request Aug 7, 2018
79: Updated documentation to note the pow(0, 0) case. r=cuviper a=meltinglava

Ref #78 

Co-authored-by: Roald <meltinglava>
@bors
Copy link
Contributor

bors bot commented Aug 7, 2018

Build succeeded

@bors bors bot merged commit 2b975ba into rust-num:master Aug 7, 2018
@hauleth
Copy link
Member

hauleth commented Aug 8, 2018

@cuviper my comment was in favour of current behaviour as I think it is more reasonable solution in case of computation. pow(0, 0) is "mathematically undefined" when we are working in area of mathematical analysis, and in such case num crate isn't that much helpful. We could quote this paper as a reasoning for current behaviour and why we think it is acceptable for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants