[issue44357] Add math.cbrt() function: Cube Root

2021-06-16 Thread Mark Dickinson
Change by Mark Dickinson : -- assignee: -> mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44357] Add math.cbrt() function: Cube Root

2021-06-10 Thread Mark Dickinson
Mark Dickinson added the comment: All done; closing. Thank you for the contribution! -- stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue44357] Add math.cbrt() function: Cube Root

2021-06-10 Thread Mark Dickinson
Mark Dickinson added the comment: New changeset ac867f10b49322e25f34d2d8abd8e63c86834750 by Ajith Ramachandran in branch 'main': bpo-44357:Add `math.cbrt()` function: Cube Root (GH-26622) https://github.com/python/cpython/commit/ac867f10b49322e25f34d2d8abd8e63c86834750 --

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Mark Dickinson
Mark Dickinson added the comment: If we *really* wanted to bikeshed on the name, back in 1991 Kahan wrote: > Perhaps the last problem is the hardest: choosing the program's name. Ideally > it should need no explanation, but a limitation upon its length may preclude > that. Although "CBRT"

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Mark Dickinson
Mark Dickinson added the comment: @Victor: Yep, the name is pretty standard. Not just C, but JavaScript, Java, R, and likely a lot of other languages that I haven't checked. -- ___ Python tracker

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread STINNER Victor
STINNER Victor added the comment: I didn't know the "cbrt" function name. It seems like it exists in the libc, but also in numpy. So it's a good idea to reuse this name ;-) numpy.cbrt(): Return the cube-root of an array, element-wise.

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Mark Dickinson
Mark Dickinson added the comment: There's also a decent chance that a libm implementation of cbrt will be correctly rounded, while `x**(1/3)` is highly unlikely to be so. -- ___ Python tracker

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Mark Dickinson
Mark Dickinson added the comment: > Perhaps because it is so easy to write x**(1/3), and if you want a real root > of negative argument, it is -(-x)**(1/3). I consider `x**(1/3)` to be a trap and a bug magnet: many people won't realise that the correct spelling for their situation is

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Ajith Ramachandran
Ajith Ramachandran added the comment: Yes I was aware of x**(1/3) and used that. I just thought it would be useful if it was present in math module as it is also used in many situations like `sqrt()`. -- ___ Python tracker

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am surprised that this was not proposed before. Perhaps because it is so easy to write x**(1/3), and if you want a real root of negative argument, it is -(-x)**(1/3). It can be slightly less accurate that the result of C library function cbrt(), but

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Ajith Ramachandran
Ajith Ramachandran added the comment: When I needed a function to find cube root, I couldn't find one in the math module. Also found the `cbrt()` function in C. I didn't account for the complex numbers. I didn't wanted to make it a complex function unnecessarily. So I used the `cbrt()`

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Mark Dickinson
Mark Dickinson added the comment: BTW, to forestall questions about adding cmath.cbrt: it's not obvious how to extend the real cube root function to a complex cube root, so it might make sense to wait for actual use-cases before doing so. The issue is that the most natural way to define a

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Mark Dickinson
Mark Dickinson added the comment: +1. This is part of C99, so if it's also supported by Visual Studio, then this seems like a no-brainer. If it's _not_ also supported by Visual Studio, or if there are implementations that have serious numerical problems (as was the case with fma) we'll need

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Ajith Ramachandran
Change by Ajith Ramachandran : -- keywords: +patch pull_requests: +25206 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26622 ___ Python tracker

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : See also issue27353. -- nosy: +lemburg, mark.dickinson, rhettinger, serhiy.storchaka, stutzbach versions: +Python 3.11 -Python 3.10 ___ Python tracker

[issue44357] Add math.cbrt() function: Cube Root

2021-06-09 Thread Ajith Ramachandran
Change by Ajith Ramachandran : -- components: Library (Lib) nosy: AjithRamachandran priority: normal severity: normal status: open title: Add math.cbrt() function: Cube Root type: enhancement versions: Python 3.10 ___ Python tracker