dotnet / dotnet/dotnet-api-docs

Double and float round-trip string format confusion

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

Description

The following article mentions that instead of using the round-trip specifier `R` for double and float, `G17` and `G9` should be used respectively. It also mentions the `R` specifier may be slower than `G17`. However, according to a blog post about .NET Core 3.1, this has since been fixed. Can we get some clarification on whether `G17` is still the recommendation?

Docs mentioning not to use `R`:
https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#round-trip-format-specifier-r
https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#standard-format-specifiers

Blog post:
https://devblogs.microsoft.com/dotnet/floating-point-parsing-and-formatting-improvements-in-net-core-3-0/#making-the-parser-ieee-compliant

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.