> On 30 Mar 2023, at 18:11, Barry Scott <ba...@barrys-emacs.org> wrote:
> 
> 
> 
>> On 30 Mar 2023, at 10:15, Andreas Eisele <andreas.eis...@gmail.com> 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 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. I am wondering for the rationale 
>> of this. Does math.pow() do anything that the built-in version can not do, 
>> and if not, why is it even there?
> 
> Maybe math.pow() aways using IEEE 754(?) float point via the C runtime math 
> routines.
> pow() will give int answer if called with int args.

And the C version of pow only supports 2 arg call.

SYNOPSIS
     #include <math.h>

     double
     pow(double x, double y);

     long double
     powl(long double x, long double y);

     float
     powf(float x, float y);


> 
> Barry
> 
> 
>> Thanks in advance for any enlightening comment on this.
>> Best regards, Andreas
>> -- 
>> https://mail.python.org/mailman/listinfo/python-list
>> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to