A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-September/017379.html below:

[Python-Dev] 3-arg float pow()

[Python-Dev] 3-arg float pow()Tim Peters tim.one@home.com
Mon, 3 Sep 2001 03:05:53 -0400
Python's builtin 3-argument pow() exists because, e.g.,

>>> pow(3L, 500, 7)
2L
>>>

can be done very much faster, and with much less memory, than

>>> 3L**500 % 7
2L
>>>

There isn't any compelling use I know of for 3-arg pow() given float
arguments, though, and what you get back is a platform-dependent accident:

>>> pow(3., 500., 7.)
4.0
>>>

You may get some other integer there, or an Infinity or a NaN, depending on
the Python release, and the compiler used to build Python, and the
configuration of your libm.  That example was done under CVS 2.2a2+ on
Windows; here's the same thing but under 2.2.1:

>>> pow(3., 500., 7.)
0.0
>>>

Since 3-argument float pow() *appears* to be at best useless, I'm taking it
away in 2.2a3, unless someone can testify to a reasonable use case that's
actually used.

more-trouble-than-it's-worth-if-it-isn't-worth-anything-ly y'rs  - tim




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4