dotnet / dotnet/dotnet-api-docs

Infinity is a real number?

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

Description

This concerns the documentation for double.IsRealNumber: https://learn.microsoft.com/en-us/dotnet/api/system.double.isrealnumber?view=net-8.0

I was surprised to find while testing that this returns `true` for `double.PositiveInfinity` and `double.NegativeInfinity`. In math class, we learn that infinities are not real numbers, so I think that this should be made absolutely clear in the documentation.

However, we just have the following description: "Determines if a value represents a real number."
I think this will lead other people to assume (like I did) that it would return `false` for infinities.

Confusingly, there is also this remark: "This function returns true for a complex number a + bi where b is zero."
But we're talking about doubles here, which as far as I'm aware, can never be complex-valued. I assume this is inherited from `INumberBase.IsRealNumber(TSelf)`?

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.