On 10/2/22 00:04, Fausto via Digitalmars-d-learn wrote:
Hello,

I am trying to use pow with an integer argument, but I cannot have a bigint 
result, for example, ```pow(10,72)```.
Do I have to write my pow function or is there a native solution?

thanks,
Fausto


In contrast to certain scripting languages, there's no implicit promotion, you 
have to opt in for BigInt [1] usage in D:

```d
import std;
void main()
{
    // all print the same
    writeln(BigInt(10) ^^ 72);
    writeln(10.BigInt ^^ 72);
    writeln("10".BigInt ^^ 72);
}
```

[1] https://dlang.org/phobos/std_bigint.html#.BigInt

Reply via email to