Skip to content

Commit c102e3e

Browse files
committed
Regenerate code from PRs
1 parent c1f83dd commit c102e3e

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// </auto-generated>
1616
//------------------------------------------------------------------------------
1717

18-
// Copyright (c) 2007 Andreas Gullberg Larsen (angularsen@gmail.com).
18+
// Copyright (c) 2007 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
1919
// https://github.com/angularsen/UnitsNet
2020
//
2121
// Permission is hereby granted, free of charge, to any person obtaining a copy

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// </auto-generated>
1616
//------------------------------------------------------------------------------
1717

18-
// Copyright (c) 2007 Andreas Gullberg Larsen (angularsen@gmail.com).
18+
// Copyright (c) 2007 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
1919
// https://github.com/angularsen/UnitsNet
2020
//
2121
// Permission is hereby granted, free of charge, to any person obtaining a copy

UnitsNet/GeneratedCode/Quantities/Entropy.g.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// </auto-generated>
1616
//------------------------------------------------------------------------------
1717

18-
// Copyright (c) 2007 Andreas Gullberg Larsen (angularsen@gmail.com).
18+
// Copyright (c) 2007 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
1919
// https://github.com/angularsen/UnitsNet
2020
//
2121
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -56,7 +56,7 @@
5656
namespace UnitsNet
5757
{
5858
/// <summary>
59-
///
59+
/// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J K−1) in the International System of Units
6060
/// </summary>
6161
// ReSharper disable once PartialTypeWithSinglePart
6262

@@ -1060,19 +1060,22 @@ int CompareTo(Entropy other)
10601060
return left._joulesPerKelvin > right._joulesPerKelvin;
10611061
}
10621062

1063+
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
10631064
public static bool operator ==(Entropy left, Entropy right)
10641065
{
10651066
// ReSharper disable once CompareOfFloatsByEqualityOperator
10661067
return left._joulesPerKelvin == right._joulesPerKelvin;
10671068
}
10681069

1070+
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
10691071
public static bool operator !=(Entropy left, Entropy right)
10701072
{
10711073
// ReSharper disable once CompareOfFloatsByEqualityOperator
10721074
return left._joulesPerKelvin != right._joulesPerKelvin;
10731075
}
10741076
#endif
10751077

1078+
[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")]
10761079
public override bool Equals(object obj)
10771080
{
10781081
if (obj == null || GetType() != obj.GetType())
@@ -1083,6 +1086,19 @@ public override bool Equals(object obj)
10831086
return _joulesPerKelvin.Equals(((Entropy) obj)._joulesPerKelvin);
10841087
}
10851088

1089+
/// <summary>
1090+
/// Compare equality to another Entropy by specifying a max allowed difference.
1091+
/// Note that it is advised against specifying zero difference, due to the nature
1092+
/// of floating point operations and using System.Double internally.
1093+
/// </summary>
1094+
/// <param name="other">Other quantity to compare to.</param>
1095+
/// <param name="maxError">Max error allowed.</param>
1096+
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
1097+
public bool Equals(Entropy other, Entropy maxError)
1098+
{
1099+
return Math.Abs(_joulesPerKelvin - other._joulesPerKelvin) <= maxError._joulesPerKelvin;
1100+
}
1101+
10861102
public override int GetHashCode()
10871103
{
10881104
return _joulesPerKelvin.GetHashCode();

UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// </auto-generated>
1616
//------------------------------------------------------------------------------
1717

18-
// Copyright (c) 2007 Andreas Gullberg Larsen (angularsen@gmail.com).
18+
// Copyright (c) 2007 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
1919
// https://github.com/angularsen/UnitsNet
2020
//
2121
// Permission is hereby granted, free of charge, to any person obtaining a copy

0 commit comments

Comments
 (0)