Click or drag to resize

HelmholtzEquationOfStateOfPureFluidsGetRelativeErrorBetween Method

Computes a symmetric relative error between two numeric values.

Namespace: Altaxo.Science.Thermodynamics.Fluids
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3448.0 (4.8.3448.0)
Syntax
C#
public static double GetRelativeErrorBetween(
	double x,
	double y
)

Parameters

x  Double
The first value to compare.
y  Double
The second value to compare.

Return Value

Double
The relative error defined as |x - y| / min(|x|, |y|). Returns PositiveInfinity if either value is NaN or infinite, or when the smaller absolute value is zero while the values differ. Returns 0 when both values are equal (including both zero).
Remarks
This helper is used to compare two numbers in a scale-invariant way. It avoids division by very small numbers by using the smaller of the absolute magnitudes as denominator and signals an undefined comparison with PositiveInfinity when comparison is not meaningful.
See Also