How to throw an error on value overflow?

For example, in Int64:

10^21 returns 3875820019684212736

How do you turn off rollover and just throw an error instead?

You can’t, but upon consideration I feel like it might be worth it to do integer overflow checking for ^. It’s relatively isolated, and it’s the most common place where people encounter this. I’ll submit a PR to this effect and see what people think.

2 Likes

PR can be seen here: