dotnet / dotnet/dotnet-api-docs

System.MathF.Abs Max/MinValue relation

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

Description

[The docs](https://docs.microsoft.com/en-us/dotnet/api/system.mathf.abs?view=net-5.0#System_MathF_Abs_System_Single_) claim that
a) The parameter `x` is "A number that is greater than or equal to MinValue, but less than or equal to MaxValue." and
b) The return type to be "A single-precision floating-point number, x, such that 0 ≤ x ≤ MaxValue."
which is just not true.
MathF.Abs allows Positive/NegativeInfinity (and returns PositiveInfinity, as expected) and also accepts NaN where it, as expected, returns NaN, for all three of these both of the conditions are untrue, is this somehow undefined behaviour, or simply a mistake in the docs?

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.