File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ namespace UnitsNet
28
28
/// </summary>
29
29
public struct Length : IComparable , IComparable < Length >
30
30
{
31
+ private const double MilsToMetersRatio = 2.54E-5 ;
31
32
public readonly double Meters ;
32
33
33
34
/// <summary>
@@ -97,7 +98,7 @@ public double Microinch
97
98
98
99
public double Mil
99
100
{
100
- get { return Meters * 39370.0787 ; }
101
+ get { return Meters / MilsToMetersRatio ; }
101
102
}
102
103
103
104
#endregion
@@ -185,9 +186,9 @@ public static Length FromMicroinches(double mi)
185
186
return FromMeters ( mi / 39370078.7 ) ;
186
187
}
187
188
188
- public static Length FromMils ( double m )
189
+ public static Length FromMils ( double mils )
189
190
{
190
- return FromMeters ( m / 39370.0787 ) ;
191
+ return FromMeters ( mils * MilsToMetersRatio ) ;
191
192
}
192
193
193
194
#endregion
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public void MetersToDistanceUnits()
26
26
Assert . AreEqual ( 3.28084 , meter . Feet , Delta ) ;
27
27
Assert . AreEqual ( 39.3701 , meter . Inches , Delta ) ;
28
28
Assert . AreEqual ( 39370078.7 , meter . Microinch , Delta ) ;
29
- Assert . AreEqual ( 39370.0787 , meter . Mil , Delta ) ;
29
+ Assert . AreEqual ( 39370.07874015 , meter . Mil , Delta ) ;
30
30
}
31
31
32
32
[ Test ]
You can’t perform that action at this time.
0 commit comments