File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 * Licensing: MIT https://github.com/electricessence/Open/blob/dotnet-core/LICENSE.md
44 */
55
6- using System ;
76using Open . Numeric . Precision ;
7+ using System ;
88
99
1010namespace 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}
You can’t perform that action at this time.
0 commit comments