Skip to content

Commit a257085

Browse files
author
Oren (electricessence)
committed
Reformat and contract improvments.
1 parent 39566c4 commit a257085

5 files changed

Lines changed: 338 additions & 334 deletions

File tree

Numeric.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* Licensing: MIT https://github.com/electricessence/Open/blob/dotnet-core/LICENSE.md
44
*/
55

6-
using System;
76
using Open.Numeric.Precision;
7+
using System;
88

99

1010
namespace Open.Numeric
1111
{
12-
public static class Extensions
12+
public static class Extensions
1313
{
1414
#region Numeric shortcuts.
1515
public static bool IsNaN(this double value)
@@ -32,19 +32,19 @@ public static bool IsDefault(this double value)
3232

3333
}
3434

35-
public static class NumericConvert
36-
{
37-
38-
/// <summary>
39-
/// Accurate way to convert possible float to double by converting to string first. Avoids tolerance issues.
40-
/// Uses default double convert if not a float.
41-
/// </summary>
42-
public static double ToDouble(object value)
43-
{
44-
if (value == null)
45-
return double.NaN;
46-
47-
return value is float ? ((float)value).ToDouble() : Convert.ToDouble(value);
48-
}
49-
}
35+
public static class NumericConvert
36+
{
37+
38+
/// <summary>
39+
/// Accurate way to convert possible float to double by converting to string first. Avoids tolerance issues.
40+
/// Uses default double convert if not a float.
41+
/// </summary>
42+
public static double ToDouble(object value)
43+
{
44+
if (value == null)
45+
return double.NaN;
46+
47+
return value is float ? ((float)value).ToDouble() : Convert.ToDouble(value);
48+
}
49+
}
5050
}

0 commit comments

Comments
 (0)