Describe the bug
The Compressibility type produces incorrect results when converting between InverseKilopascal and InversePoundForcePerSquareInch. The conversion factor is being applied in the wrong direction — the result is the reciprocal of the correct value.
Expected behavior
Since 1 psi = 6.894757293 kPa, one "per kilopascal" represents a larger compressibility than one "per psi". Therefore:
- 1 kPa⁻¹ = 6.894757293 psi⁻¹
- 1 psi⁻¹ = 0.145037738 kPa⁻¹
Actual behavior
UnitsNet returns the reciprocal of the correct values:
- 1 kPa⁻¹ = 0.145037738 psi⁻¹ ❌
- 1 psi⁻¹ = 6.894757293 kPa⁻¹ ❌
To reproduce
var c = Compressibility.FromInverseKilopascals(1.0);
Console.WriteLine(c.ToUnit(CompressibilityUnit.InversePoundForcePerSquareInch));
// Prints: 0.145037738 psi⁻¹ (expected: 6.894757293 psi⁻¹)
Root cause
The conversion factor between InverseKilopascal and InversePoundForcePerSquareInch appears to be inverted in Compressibility.json. The FromUnitToBaseFunc and FromBaseToUnitFunc for InversePoundForcePerSquareInch are likely applying multiplication where division is needed, or vice versa.
This can be verified by cross-checking against the Pressure type, which correctly defines 1 psi = 6.894757293 kPa. For inverse pressure units, the conversion factor flips:
// Pressure type correctly gives:
double kpaPerPsi = Pressure.FromPoundsForcePerSquareInch(1.0).Kilopascals; // 6.894757293
// For compressibility (inverse pressure), the conversion is the reciprocal:
// 1 kPa^-1 = kpaPerPsi psi^-1 = 6.894757293 psi^-1
// But UnitsNet Compressibility gives: 1/kpaPerPsi = 0.145037738
Describe the bug
The
Compressibilitytype produces incorrect results when converting betweenInverseKilopascalandInversePoundForcePerSquareInch. The conversion factor is being applied in the wrong direction — the result is the reciprocal of the correct value.Expected behavior
Since 1 psi = 6.894757293 kPa, one "per kilopascal" represents a larger compressibility than one "per psi". Therefore:
Actual behavior
UnitsNet returns the reciprocal of the correct values:
To reproduce
Root cause
The conversion factor between
InverseKilopascalandInversePoundForcePerSquareInchappears to be inverted inCompressibility.json. TheFromUnitToBaseFuncandFromBaseToUnitFuncforInversePoundForcePerSquareInchare likely applying multiplication where division is needed, or vice versa.This can be verified by cross-checking against the
Pressuretype, which correctly defines 1 psi = 6.894757293 kPa. For inverse pressure units, the conversion factor flips: