Skip to content

Commit 577d84e

Browse files
committed
Converted truncated floating point numbers to fractions to get highest precision.
1 parent c3fb7a5 commit 577d84e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

UnitsNet.Tests/CustomCode/LengthTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class LengthTests : LengthTestsBase
3333

3434
protected override double FeetInOneMeter => 3.28084;
3535

36-
protected override double USSurveyFeetInOneMeter => 3.2808333333;
36+
protected override double USSurveyFeetInOneMeter => 3937/1200;
3737

3838
protected override double InchesInOneMeter => 39.37007874;
3939

UnitsNet/GeneratedCode/UnitClasses/Length.g.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public double NauticalMiles
219219
/// </summary>
220220
public double USSurveyFeet
221221
{
222-
get { return _meters/0.3048006096; }
222+
get { return _meters*3937/1200; }
223223
}
224224

225225
/// <summary>
@@ -348,7 +348,7 @@ public static Length FromNauticalMiles(double nauticalmiles)
348348
/// </summary>
349349
public static Length FromUSSurveyFeet(double ussurveyfeet)
350350
{
351-
return new Length(ussurveyfeet*0.3048006096);
351+
return new Length(ussurveyfeet*1200/3937);
352352
}
353353

354354
/// <summary>

UnitsNet/Scripts/UnitDefinitions/Length.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
{
7373
"SingularName": "USSurveyFoot",
7474
"PluralName": "USSurveyFeet",
75-
"FromUnitToBaseFunc": "x*0.3048006096",
76-
"FromBaseToUnitFunc": "x/0.3048006096",
75+
"FromUnitToBaseFunc": "x*1200/3937",
76+
"FromBaseToUnitFunc": "x*3937/1200",
7777
"Localization": [
7878
{
7979
"Culture": "en-US",

0 commit comments

Comments
 (0)