Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ExcelNumberFormat/ExcelNumberFormat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net20;netstandard1.0;netstandard2.0</TargetFrameworks>
<VersionPrefix>1.1.0</VersionPrefix>
<VersionPrefix>1.1.1</VersionPrefix>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>.NET library to parse ECMA-376 number format strings and format values like Excel and other spreadsheet softwares.</Description>
Expand Down
4 changes: 2 additions & 2 deletions src/ExcelNumberFormat/Formatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,14 @@ static string FormatExponential(double value, Section format, CultureInfo cultur

static string FormatFraction(double value, Section format, CultureInfo culture)
{
int integral = 0;
long integral = 0;
int numerator, denominator;

bool sign = value < 0;

if (format.Fraction.IntegerPart != null)
{
integral = (int)Math.Truncate(value);
integral = (long)Math.Truncate(value);
value = Math.Abs(value - integral);
}

Expand Down
2 changes: 2 additions & 0 deletions test/ExcelNumberFormat.Tests/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ public void TestFraction()

Test(0, "0", "0");

Test((double)int.MaxValue, "# ?/?", $"{int.MaxValue} ");
Test((double)int.MaxValue + 1, "# ?/?", $"{(long)int.MaxValue + 1} ");
}

void TestExponents(double value, string expected1, string expected2, string expected3, string expected4)
Expand Down