andersnm / ExcelNumberFormat

Parse and render Excel number format strings
MIT License
79 stars 27 forks source link

Explicitly specify precision when formatting floating-point numbers #21

Closed Pankraty closed 4 years ago

Pankraty commented 4 years ago

Explicitly specify precision when formatting floating-point numbers for backward compatibility with pre-Core3.0 versions of .Net

Fixes #20

Pankraty commented 4 years ago

At first, I committed changing a target framework to netcoreapp3.0 but AppVeyor does not seem to support it yet so I reverted that change. But you can try it locally to see how the behavior differs in 2.x and 3.x.

lahma commented 4 years ago

Appveyor.yml would need to have image: Visual Studio 2019, it's now pointing to old 2017 image.

andersnm commented 4 years ago

Hi and thanks. Please note it'll likely take a couple days until I get around to reviewing this!

As for netcoreapp3.0 on Appveyor, I believe you can update the image in appveyor.yml, but no biggie

image: Visual Studio 2019
andersnm commented 4 years ago

Same issue with the "General" format

    result = Format(double.MaxValue, "General", CultureInfo.InvariantCulture);
    Assert.AreEqual("1.79769313486232E+308", result);

    result = Format(float.MaxValue, "General", CultureInfo.InvariantCulture);
    Assert.AreEqual("3.402823E+38", result);
Pankraty commented 4 years ago

@andersnm you are right. Fixed this.