Skip to content

Commit 743d222

Browse files
committed
Updated conversion constants from #482
1 parent 2059e99 commit 743d222

File tree

8 files changed

+24
-90
lines changed

8 files changed

+24
-90
lines changed

Common/GeneratedCode/Quantities/Mass.Common.g.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ private double AsBaseUnit()
779779
case MassUnit.Pound: return _value*0.45359237;
780780
case MassUnit.ShortHundredweight: return _value/0.022046226218487758;
781781
case MassUnit.ShortTon: return _value*9.0718474e2;
782-
case MassUnit.Slug: return _value/6.85217659e-2;
782+
case MassUnit.Slug: return _value/6.852176556196105e-2;
783783
case MassUnit.Stone: return _value/0.1574731728702698;
784784
case MassUnit.Tonne: return _value*1e3;
785785
default:
@@ -815,7 +815,7 @@ private double AsBaseNumericType(MassUnit unit)
815815
case MassUnit.Pound: return baseUnitValue/0.45359237;
816816
case MassUnit.ShortHundredweight: return baseUnitValue*0.022046226218487758;
817817
case MassUnit.ShortTon: return baseUnitValue/9.0718474e2;
818-
case MassUnit.Slug: return baseUnitValue*6.85217659e-2;
818+
case MassUnit.Slug: return baseUnitValue*6.852176556196105e-2;
819819
case MassUnit.Stone: return baseUnitValue*0.1574731728702698;
820820
case MassUnit.Tonne: return baseUnitValue/1e3;
821821
default:

Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,8 @@ private double AsBaseUnit()
896896
case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (_value/1e9) * 1e-3d;
897897
case MassMomentOfInertiaUnit.PoundSquareFoot: return _value*4.21401101e-2;
898898
case MassMomentOfInertiaUnit.PoundSquareInch: return _value*2.9263965e-4;
899-
case MassMomentOfInertiaUnit.SlugSquareFoot: return _value*1.35583;
900-
case MassMomentOfInertiaUnit.SlugSquareInch: return _value*9.41548e-3;
899+
case MassMomentOfInertiaUnit.SlugSquareFoot: return _value*1.3558179619;
900+
case MassMomentOfInertiaUnit.SlugSquareInch: return _value*9.41540242e-3;
901901
case MassMomentOfInertiaUnit.TonneSquareCentimeter: return _value/1e1;
902902
case MassMomentOfInertiaUnit.TonneSquareDecimeter: return _value/1e-1;
903903
case MassMomentOfInertiaUnit.TonneSquareMeter: return _value/1e-3;
@@ -938,8 +938,8 @@ private double AsBaseNumericType(MassMomentOfInertiaUnit unit)
938938
case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (baseUnitValue*1e9) / 1e-3d;
939939
case MassMomentOfInertiaUnit.PoundSquareFoot: return baseUnitValue/4.21401101e-2;
940940
case MassMomentOfInertiaUnit.PoundSquareInch: return baseUnitValue/2.9263965e-4;
941-
case MassMomentOfInertiaUnit.SlugSquareFoot: return baseUnitValue/1.35583;
942-
case MassMomentOfInertiaUnit.SlugSquareInch: return baseUnitValue/9.41548e-3;
941+
case MassMomentOfInertiaUnit.SlugSquareFoot: return baseUnitValue/1.3558179619;
942+
case MassMomentOfInertiaUnit.SlugSquareInch: return baseUnitValue/9.41540242e-3;
943943
case MassMomentOfInertiaUnit.TonneSquareCentimeter: return baseUnitValue*1e1;
944944
case MassMomentOfInertiaUnit.TonneSquareDecimeter: return baseUnitValue*1e-1;
945945
case MassMomentOfInertiaUnit.TonneSquareMeter: return baseUnitValue*1e-3;

Common/UnitDefinitions/Mass.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@
113113
{
114114
"SingularName": "Slug",
115115
"PluralName": "Slugs",
116-
"FromUnitToBaseFunc": "x/6.85217659e-2",
117-
"FromBaseToUnitFunc": "x*6.85217659e-2",
116+
"FromUnitToBaseFunc": "x/6.852176556196105e-2",
117+
"FromBaseToUnitFunc": "x*6.852176556196105e-2",
118118
"XmlDocSummary": "The slug (abbreviation slug) is a unit of mass that is accelerated by 1 ft/s² when a force of one pound (lbf) is exerted on it.",
119119
"XmlDocRemarks": "http://en.wikipedia.org/wiki/Slug_(unit)",
120120
"Localization": [

Common/UnitDefinitions/MassMomentOfInertia.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@
138138
{
139139
"SingularName": "SlugSquareFoot",
140140
"PluralName": "SlugSquareFeet",
141-
"FromUnitToBaseFunc": "x*1.35583",
142-
"FromBaseToUnitFunc": "x/1.35583",
141+
"FromUnitToBaseFunc": "x*1.3558179619",
142+
"FromBaseToUnitFunc": "x/1.3558179619",
143143
"Localization": [
144144
{
145145
"Culture": "en-US",
@@ -150,8 +150,8 @@
150150
{
151151
"SingularName": "SlugSquareInch",
152152
"PluralName": "SlugSquareInches",
153-
"FromUnitToBaseFunc": "x*9.41548e-3",
154-
"FromBaseToUnitFunc": "x/9.41548e-3",
153+
"FromUnitToBaseFunc": "x*9.41540242e-3",
154+
"FromBaseToUnitFunc": "x/9.41540242e-3",
155155
"Localization": [
156156
{
157157
"Culture": "en-US",

UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -256,34 +256,11 @@ public static class NumberToMassExtensions
256256
#region Slug
257257

258258
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
259-
public static Mass Slugs(this int value) => Mass.FromSlugs(value);
259+
public static Mass Slugs<T>(this T value) => Mass.FromSlugs(Convert.ToDouble(value));
260260

261261
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
262-
public static Mass? Slugs(this int? value) => Mass.FromSlugs(value);
263-
264-
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
265-
public static Mass Slugs(this long value) => Mass.FromSlugs(value);
266-
267-
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
268-
public static Mass? Slugs(this long? value) => Mass.FromSlugs(value);
269-
270-
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
271-
public static Mass Slugs(this double value) => Mass.FromSlugs(value);
272-
273-
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
274-
public static Mass? Slugs(this double? value) => Mass.FromSlugs(value);
275-
276-
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
277-
public static Mass Slugs(this float value) => Mass.FromSlugs(value);
278-
279-
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
280-
public static Mass? Slugs(this float? value) => Mass.FromSlugs(value);
281-
282-
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
283-
public static Mass Slugs(this decimal value) => Mass.FromSlugs(Convert.ToDouble(value));
284-
285-
/// <inheritdoc cref="Mass.FromSlugs(UnitsNet.QuantityValue)" />
286-
public static Mass? Slugs(this decimal? value) => Mass.FromSlugs(value == null ? (double?)null : Convert.ToDouble(value.Value));
262+
[Obsolete("Nullable type support has been deprecated and will be removed in a future release.")]
263+
public static Mass? Slugs<T>(this T? value) where T : struct => Mass.FromSlugs(value == null ? (double?)null : Convert.ToDouble(value.Value));
287264

288265
#endregion
289266

UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -289,68 +289,22 @@ public static class NumberToMassMomentOfInertiaExtensions
289289
#region SlugSquareFoot
290290

291291
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
292-
public static MassMomentOfInertia SlugSquareFeet(this int value) => MassMomentOfInertia.FromSlugSquareFeet(value);
292+
public static MassMomentOfInertia SlugSquareFeet<T>(this T value) => MassMomentOfInertia.FromSlugSquareFeet(Convert.ToDouble(value));
293293

294294
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
295-
public static MassMomentOfInertia? SlugSquareFeet(this int? value) => MassMomentOfInertia.FromSlugSquareFeet(value);
296-
297-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
298-
public static MassMomentOfInertia SlugSquareFeet(this long value) => MassMomentOfInertia.FromSlugSquareFeet(value);
299-
300-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
301-
public static MassMomentOfInertia? SlugSquareFeet(this long? value) => MassMomentOfInertia.FromSlugSquareFeet(value);
302-
303-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
304-
public static MassMomentOfInertia SlugSquareFeet(this double value) => MassMomentOfInertia.FromSlugSquareFeet(value);
305-
306-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
307-
public static MassMomentOfInertia? SlugSquareFeet(this double? value) => MassMomentOfInertia.FromSlugSquareFeet(value);
308-
309-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
310-
public static MassMomentOfInertia SlugSquareFeet(this float value) => MassMomentOfInertia.FromSlugSquareFeet(value);
311-
312-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
313-
public static MassMomentOfInertia? SlugSquareFeet(this float? value) => MassMomentOfInertia.FromSlugSquareFeet(value);
314-
315-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
316-
public static MassMomentOfInertia SlugSquareFeet(this decimal value) => MassMomentOfInertia.FromSlugSquareFeet(Convert.ToDouble(value));
317-
318-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareFeet(UnitsNet.QuantityValue)" />
319-
public static MassMomentOfInertia? SlugSquareFeet(this decimal? value) => MassMomentOfInertia.FromSlugSquareFeet(value == null ? (double?)null : Convert.ToDouble(value.Value));
295+
[Obsolete("Nullable type support has been deprecated and will be removed in a future release.")]
296+
public static MassMomentOfInertia? SlugSquareFeet<T>(this T? value) where T : struct => MassMomentOfInertia.FromSlugSquareFeet(value == null ? (double?)null : Convert.ToDouble(value.Value));
320297

321298
#endregion
322299

323300
#region SlugSquareInch
324301

325302
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
326-
public static MassMomentOfInertia SlugSquareInches(this int value) => MassMomentOfInertia.FromSlugSquareInches(value);
303+
public static MassMomentOfInertia SlugSquareInches<T>(this T value) => MassMomentOfInertia.FromSlugSquareInches(Convert.ToDouble(value));
327304

328305
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
329-
public static MassMomentOfInertia? SlugSquareInches(this int? value) => MassMomentOfInertia.FromSlugSquareInches(value);
330-
331-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
332-
public static MassMomentOfInertia SlugSquareInches(this long value) => MassMomentOfInertia.FromSlugSquareInches(value);
333-
334-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
335-
public static MassMomentOfInertia? SlugSquareInches(this long? value) => MassMomentOfInertia.FromSlugSquareInches(value);
336-
337-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
338-
public static MassMomentOfInertia SlugSquareInches(this double value) => MassMomentOfInertia.FromSlugSquareInches(value);
339-
340-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
341-
public static MassMomentOfInertia? SlugSquareInches(this double? value) => MassMomentOfInertia.FromSlugSquareInches(value);
342-
343-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
344-
public static MassMomentOfInertia SlugSquareInches(this float value) => MassMomentOfInertia.FromSlugSquareInches(value);
345-
346-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
347-
public static MassMomentOfInertia? SlugSquareInches(this float? value) => MassMomentOfInertia.FromSlugSquareInches(value);
348-
349-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
350-
public static MassMomentOfInertia SlugSquareInches(this decimal value) => MassMomentOfInertia.FromSlugSquareInches(Convert.ToDouble(value));
351-
352-
/// <inheritdoc cref="MassMomentOfInertia.FromSlugSquareInches(UnitsNet.QuantityValue)" />
353-
public static MassMomentOfInertia? SlugSquareInches(this decimal? value) => MassMomentOfInertia.FromSlugSquareInches(value == null ? (double?)null : Convert.ToDouble(value.Value));
306+
[Obsolete("Nullable type support has been deprecated and will be removed in a future release.")]
307+
public static MassMomentOfInertia? SlugSquareInches<T>(this T? value) where T : struct => MassMomentOfInertia.FromSlugSquareInches(value == null ? (double?)null : Convert.ToDouble(value.Value));
354308

355309
#endregion
356310

UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ public partial struct Mass : IComparable, IComparable<Mass>
236236
/// <summary>
237237
/// Get nullable Mass from nullable Slugs.
238238
/// </summary>
239+
[Obsolete("Nullable type support is obsolete and will be removed in a future release.")]
239240
public static Mass? FromSlugs(QuantityValue? slugs)
240241
{
241242
return slugs.HasValue ? FromSlugs(slugs.Value) : default(Mass?);

UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ public partial struct MassMomentOfInertia : IComparable, IComparable<MassMomentO
263263
/// <summary>
264264
/// Get nullable MassMomentOfInertia from nullable SlugSquareFeet.
265265
/// </summary>
266+
[Obsolete("Nullable type support is obsolete and will be removed in a future release.")]
266267
public static MassMomentOfInertia? FromSlugSquareFeet(QuantityValue? slugsquarefeet)
267268
{
268269
return slugsquarefeet.HasValue ? FromSlugSquareFeet(slugsquarefeet.Value) : default(MassMomentOfInertia?);
@@ -271,6 +272,7 @@ public partial struct MassMomentOfInertia : IComparable, IComparable<MassMomentO
271272
/// <summary>
272273
/// Get nullable MassMomentOfInertia from nullable SlugSquareInches.
273274
/// </summary>
275+
[Obsolete("Nullable type support is obsolete and will be removed in a future release.")]
274276
public static MassMomentOfInertia? FromSlugSquareInches(QuantityValue? slugsquareinches)
275277
{
276278
return slugsquareinches.HasValue ? FromSlugSquareInches(slugsquareinches.Value) : default(MassMomentOfInertia?);

0 commit comments

Comments
 (0)