dotnet / dotnet/dotnet-api-docs

Incomplete doc on boundary conditions in BigInter.Pow

Open
#9,900 5 comments 0 reactions 0 assignees View on GitHub
area-System.Numerics Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Consider this awesome code:

var g = 0xffffffffffffffff;
var bi = new BigInteger(g);
bi = BigInteger.Pow(bi, Int32.MaxValue);

Consider this awesome exception:

System.OverflowException: 'Arithmetic operation resulted in an overflow.'

Consider this documentation:
https://learn.microsoft.com/en-us/dotnet/api/system.numerics.biginteger.pow?view=net-8.0

Specifically this incomplete part:

Exceptions
[ArgumentOutOfRangeException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception?view=net-8.0)
exponent is negative.

Is this a central location describing exceptions that may be thrown across all of BigInteger, or should all methods be documented separately?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.