Issue with General format specifier defaults
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 19h 10m
- Merged PRs (30d)
- 268
Description
The table that lists the default precision for the "G" specifier is no longer correct (at least for double) for .NET Core 3 and beyond. For instance, for double, it specifies the default precision is 15, but that's no longer the case in .NET Core 3:
```cs
// .NET Framework
99.199999999999989d.ToString() // -> 99.2
99.199999999999989d.ToString("G15") // -> 99.2
// .NET Core 3
99.199999999999989d.ToString() // -> 99.19999999999999
99.199999999999989d.ToString("G15") // -> 99.2
```
[This blog post](https://devblogs.microsoft.com/dotnet/floating-point-parsing-and-formatting-improvements-in-net-core-3-0/) describes the breaking change, and [this is an example](https://github.com/dotnet/runtime/issues/29157) of an issue that was opened because of the breaking change. The docs confused me for some time until I found the above two links.
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 0ae38fce-fc98-9420-6b0b-ceee4e885f2d
* Version Independent ID: f23035e0-f271-b48c-f9a9-8582be80b4ad
* Content: [Standard numeric format strings](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#GFormatString)
* Content Source: [docs/standard/base-types/standard-numeric-format-strings.md](https://github.com/dotnet/docs/blob/main/docs/standard/base-types/standard-numeric-format-strings.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @adegeo
* Microsoft Alias: **adegeo**
Contributor guide
Assessment
This issue has not been assessed yet.