Re: built-in pow() vs. math.pow()

2023-04-03 Thread 2QdxY4RzWzUUiLuE
On 2023-04-01 at 08:16:46 -0700, Andreas Eisele wrote: > BTW, there is another difference: built-in pow() deals with complex > arguments, while functions in math won't accept them at all. See also . --

Re: built-in pow() vs. math.pow()

2023-04-03 Thread Andreas Eisele
Andreas Eisele schrieb am Donnerstag, 30. März 2023 um 11:16:02 UTC+2: > I sometimes make use of the fact that the built-in pow() function has an > optional third argument for modulo calculation, which is handy when dealing > with tasks from number theory, very large numbers, problems from

Re: built-in pow() vs. math.pow()

2023-03-31 Thread Oscar Benjamin
On Fri, 31 Mar 2023 at 20:24, Peter J. Holzer wrote: > > On 2023-03-31 07:39:25 +0100, Barry wrote: > > On 30 Mar 2023, at 22:30, Chris Angelico wrote: > > > It's called math.pow. That on its own should be a strong indication > > > that it's designed to work with floats. > > > > So long as you

Re: built-in pow() vs. math.pow()

2023-03-31 Thread Peter J. Holzer
On 2023-03-31 07:39:25 +0100, Barry wrote: > On 30 Mar 2023, at 22:30, Chris Angelico wrote: > > It's called math.pow. That on its own should be a strong indication > > that it's designed to work with floats. > > So long as you know that the math module is provided to give access > the C math.h

Re: built-in pow() vs. math.pow()

2023-03-31 Thread Barry
> On 30 Mar 2023, at 22:30, Chris Angelico wrote: > > On Fri, 31 Mar 2023 at 08:13, Oscar Benjamin > wrote: >> >>> On Thu, 30 Mar 2023 at 17:31, Andreas Eisele >>> wrote: >>> >>> I sometimes make use of the fact that the built-in pow() function has an >>> optional third argument for

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Chris Angelico
On Fri, 31 Mar 2023 at 08:13, Oscar Benjamin wrote: > > On Thu, 30 Mar 2023 at 17:31, Andreas Eisele wrote: > > > > I sometimes make use of the fact that the built-in pow() function has an > > optional third argument for modulo calculation, which is handy when dealing > > with tasks from

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Oscar Benjamin
On Thu, 30 Mar 2023 at 17:31, Andreas Eisele wrote: > > I sometimes make use of the fact that the built-in pow() function has an > optional third argument for modulo calculation, which is handy when dealing > with tasks from number theory, very large numbers, problems from Project > Euler,

RE: built-in pow() vs. math.pow()

2023-03-30 Thread avi.e.gross
Some questions are more reasonable than others. If the version of a function used in a package were IDENTICAL to the built-in, then why have it? There are many possible reasons a package may tune a function for their own preferences or re-use a name that ends up blocking the view of another

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Dennis Lee Bieber
On Thu, 30 Mar 2023 19:22:53 +0200, Roel Schroeven declaimed the following: >Either import the things you need explicitly: "from math import sin, >cos, exp" (for example). >Or a plain import: "import math" combined with "math.sin", "math.cos". >Or use an abbreviation: "import math as m"

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Grant Edwards
On 2023-03-30, Thomas Passin wrote: > On 3/30/2023 5:15 AM, Andreas Eisele wrote: >> [...] I was unpleasantly surprised that math.pow() does not have >> this feature, hence "from math import *" overwrites the built-in >> pow() function with a function that lacks functionality. [...] > > Not an

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Thomas Passin
On 3/30/2023 5:15 AM, Andreas Eisele wrote: I sometimes make use of the fact that the built-in pow() function has an optional third argument for modulo calculation, which is handy when dealing with tasks from number theory, very large numbers, problems from Project Euler, etc. I was

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Roel Schroeven
Andreas Eisele schreef op 30/03/2023 om 11:15: I sometimes make use of the fact that the built-in pow() function has an optional third argument for modulo calculation, which is handy when dealing with tasks from number theory, very large numbers, problems from Project Euler, etc. I was

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Barry Scott
> On 30 Mar 2023, at 18:11, Barry Scott wrote: > > > >> On 30 Mar 2023, at 10:15, Andreas Eisele wrote: >> >> I sometimes make use of the fact that the built-in pow() function has an >> optional third argument for modulo calculation, which is handy when dealing >> with tasks from number

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Barry Scott
> On 30 Mar 2023, at 10:15, Andreas Eisele wrote: > > I sometimes make use of the fact that the built-in pow() function has an > optional third argument for modulo calculation, which is handy when dealing > with tasks from number theory, very large numbers, problems from Project > Euler,