John Moeller | 20 May 18:33
Picon

Re: [math] pow redux and observations

John Moeller <fishcorn <at> gmail.com> writes:

> Note also, please, that positive_power<0,false> returns 1 when base is 0.  
> Since 
> 0^0 is technically undefined, the "N=0" case should probably be handled at a 
> higher level (in power_if_positive, perhaps), and cause an error, just like 
> negative powers of 0.  If that is done, the 0/false case could be removed from 
> positive_power.

Actually, a rationale could be provided for pow<0>(0) == 1.  But it should be 
explained in the documentation.  Alternatively, you could use a policy class, I 
suppose.  Either way, pow<0> should probably be handled as a special case, not 
in positive_power.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Gmane