Skip to content

Commit

Permalink
Regenerate code from PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
angularsen committed Nov 11, 2017
1 parent c1f83dd commit c102e3e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

// Copyright (c) 2007 Andreas Gullberg Larsen (angularsen@gmail.com).
// Copyright (c) 2007 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
// https://github.com/angularsen/UnitsNet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

// Copyright (c) 2007 Andreas Gullberg Larsen (angularsen@gmail.com).
// Copyright (c) 2007 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
// https://github.com/angularsen/UnitsNet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
20 changes: 18 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/Entropy.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

// Copyright (c) 2007 Andreas Gullberg Larsen (angularsen@gmail.com).
// Copyright (c) 2007 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
// https://github.com/angularsen/UnitsNet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -56,7 +56,7 @@
namespace UnitsNet
{
/// <summary>
///
/// 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
/// </summary>
// ReSharper disable once PartialTypeWithSinglePart

Expand Down Expand Up @@ -1060,19 +1060,22 @@ int CompareTo(Entropy other)
return left._joulesPerKelvin > right._joulesPerKelvin;
}

[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.")]
public static bool operator ==(Entropy left, Entropy right)
{
// ReSharper disable once CompareOfFloatsByEqualityOperator
return left._joulesPerKelvin == right._joulesPerKelvin;
}

[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.")]
public static bool operator !=(Entropy left, Entropy right)
{
// ReSharper disable once CompareOfFloatsByEqualityOperator
return left._joulesPerKelvin != right._joulesPerKelvin;
}
#endif

[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.")]
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
Expand All @@ -1083,6 +1086,19 @@ public override bool Equals(object obj)
return _joulesPerKelvin.Equals(((Entropy) obj)._joulesPerKelvin);
}

/// <summary>
/// Compare equality to another Entropy by specifying a max allowed difference.
/// Note that it is advised against specifying zero difference, due to the nature
/// of floating point operations and using System.Double internally.
/// </summary>
/// <param name="other">Other quantity to compare to.</param>
/// <param name="maxError">Max error allowed.</param>
/// <returns>True if the difference between the two values is not greater than the specified max.</returns>
public bool Equals(Entropy other, Entropy maxError)
{
return Math.Abs(_joulesPerKelvin - other._joulesPerKelvin) <= maxError._joulesPerKelvin;
}

public override int GetHashCode()
{
return _joulesPerKelvin.GetHashCode();
Expand Down
2 changes: 1 addition & 1 deletion UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

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

0 comments on commit c102e3e

Please sign in to comment.