Nim Nuggets: Nim talk at Strange Loop 2021

Bastiaan Veelo Bastiaan at
Mon Oct 18 14:23:07 UTC 2021

On Sunday, 17 October 2021 at 16:10:56 UTC, Ola Fosheim Grøstad 
> On Sunday, 17 October 2021 at 14:47:15 UTC, Imperatorn wrote:
>> How would you write it in C++ without modifying the stdlib
> Well, you can't because pow() is not known at compile time (in 
> a portable way). It is only known, in the general case, when 
> executed. If you allow it to be evaluated at compile time you 
> risk a compiletime pow(x,y) value to be different from a 
> runtime pow(x,y) value even though the parameters are exactly 
> the same. Which could lead to bugs (like comparing for 
> equality).

We can leave floating point out of the discussion. This is 
integer arithmetic.

— Bastiaan.

More information about the Digitalmars-d mailing list