dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.26k stars 5.89k forks source link

decimal isn't float128. C# reference is misleading. #24941

Open aensidhe opened 3 years ago

aensidhe commented 3 years ago

Issue description

C# Reference specifies that decimal type is float128, but according to C# specification it is not. And, according to specification it has very little in common with IEEE754 float128. We should remove this misleading information from the doc.

Target framework

All of them, it's C# language reference.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

BillWagner commented 3 years ago

@aensidhe

Thanks for raising this. I looked at the page you reference, and the C# spec, including the latest ECMA standard, and I don't find a reference to IEEEfloat128. The size is 128 bytes, see https://github.com/dotnet/docs/issues/24883#issuecomment-869977792 for reference.

Can you point me to the text that should change, or create a PR with a suggested update? Thank you.

ForNeVeR commented 3 years ago

@BillWagner, the C# specification explicitly contrasts decimal and "the floating-point types", which, I assume, means they're different things:

The decimal type has greater precision but smaller range than the floating-point types.

At the same time, the C# reference includes decimal into the same table as "the floating-point types", which is a contradiction.

decimal is never mentioned to relate to float128, though.

BillWagner commented 3 years ago

Thanks for the clarifications.

This could use an edit where we make that distinction better. I'm not sure what the best edit is yet.

A major justification for including decimal with "floating point types", despite the distinction, is that it's one of the most popular search terms for all non-integral numeric types. However, we should edit this to avoid any mis-representation or misleading statements.