Created
July 3, 2020 11:39
-
-
Save 0xced/e79a3ae7216528752b2c2663a4e9a158 to your computer and use it in GitHub Desktop.
Formatting of -0 in .NET Core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Globalization; | |
static class Program | |
{ | |
private static void Main() | |
{ | |
static string FormatCoordinate(double x, double y) => $"({x.ToString(NumberFormatInfo.InvariantInfo)},{y.ToString(NumberFormatInfo.InvariantInfo)})"; | |
const double a = 0; | |
const double b = 0; | |
Console.WriteLine(FormatCoordinate(0, -0)); | |
Console.WriteLine(FormatCoordinate(a, -b)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
</PropertyGroup> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment