[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Gideon


Gideon  added the comment:

I've submitted a PR at https://github.com/python/cpython/pull/29829.

I'd just like to add that the whole Python team is amazing. Thank you for doing 
what you do!

--

___
Python tracker 
<https://bugs.python.org/issue45917>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Gideon


Gideon  added the comment:

Sounds good. I've already made the necessary code changes on my own build, so 
I'll just finish writing the tests + documentation and submit a PR.

--

___
Python tracker 
<https://bugs.python.org/issue45917>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Gideon

New submission from Gideon :

Dear Python Support Team,

I was looking through Python’s list of supported methods in the math module, 
and I noticed that C99’s exp2 method was not implemented. This method raises 2 
to the power of the supplied argument. I understand that it’s pretty trivial to 
so this in Python using 2**x or math.pow(x, 2), but I think there are a few 
reasons why we might want to incorporate it:

Uniformity: This method exists most other programming languages and libraries, 
including numpy.

Consistency: Every math method from C99 except exp2 is in python’s math or 
cmath module (math.cbrt will be added as of python 3.11).

Triviality: this method is a part of C99 and is also supported by Visual 
Studio, so it’s very easy to implement. 

Accuracy(?): a libm exp2 is supposedly more accurate than pow(2.0, x), though I 
don’t really see how this would be the case (See 
https://bugs.python.org/issue31980)


That said, this method is a little redundant, so I completely understand if 
this request is rejected

Non-exhaustive list of other languages / libraries that use this method:

Rust: https://docs.rs/libm/0.1.1/libm/fn.exp2.html
Javascript: https://github.com/stdlib-js/math-base-special-exp2
Numpy: https://numpy.org/doc/stable/reference/generated/numpy.exp2.html
C++: https://en.cppreference.com/w/cpp/numeric/math/exp2 (Not authoritative)
Ruby: https://www.rubydoc.info/gems/ruby-mpfi/MPFI%2FMath.exp2

Similar Issues:
https://bugs.python.org/issue44357
https://bugs.python.org/issue31980

--
components: Library (Lib)
messages: 407214
nosy: Gideon
priority: normal
severity: normal
status: open
title: Add math.exp2() function: 2^x
type: enhancement
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue45917>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3720] segfault in for loop with evil iterator

2008-08-28 Thread Gideon Smeding

New submission from Gideon Smeding [EMAIL PROTECTED]:

The attached example crashes python. The crash is caused by an evil 
iterator that removes its own next function.

--
files: baditerator.py
messages: 72119
nosy: gideon
severity: normal
status: open
title: segfault in for loop with evil iterator
type: crash
versions: Python 2.5, Python 3.0
Added file: http://bugs.python.org/file11300/baditerator.py

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3720
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com