Skip to content

fix: use exact pound-force, kip, poundal and psi ratios - #898

Open
bardrop wants to merge 1 commit into
jonahsnider:mainfrom
bardrop-oss:fix/exact-pound-force
Open

bardrop wants to merge 1 commit into
jonahsnider:mainfrom
bardrop-oss:fix/exact-pound-force

Conversation

@bardrop

@bardrop bardrop commented Nov 22, 2026

Copy link
Copy Markdown

Four force/pressure ratios were rounded, but each is exact by definition:

unit before exact rel. error before
lbf 4.448222 N 0.45359237 kg × 9.80665 m/s² = 4.4482216152605 N 8.6e-8
kip 4448.2216 N 1000 lbf = 4448.2216152605 N 3.4e-9
pdl 0.138255 N 0.45359237 kg × 0.3048 m/s² = 0.138254954376 N 3.3e-7
psi 6894.757 Pa 1 lbf / (0.0254 m)² = 6894.757293168362 Pa 4.3e-8

So before this change convert(1, 'lbf').to('kgf') gave 0.4535924092… instead of 0.45359237 (the pound is defined as 0.45359237 kg).

Changes:

  • force.ts: a poundForce BigNumber (0.45359237 × 9.80665); lbf and kip use it, pdl is 0.45359237 × 0.3048.
  • pressure.ts: psi is poundForce / 0.0254², the same way Torr already uses 101325 / 760.
  • New force.test.ts (lbf, kip, pdl in N; lbf in kgf and pdl). The psi test now checks 6894.757293168362 Pa instead of the rounded 6.894757 - 3ε kPa.

The 6 new or changed assertions fail on main and pass with the fix. pnpm test:ci passes.

lbf was 4.448222 N, kip 4448.2216 N, pdl 0.138255 N and psi 6894.757 Pa.
All four are exact by definition: 1 lbf = 0.45359237 kg * 9.80665 m/s²,
1 pdl = 0.45359237 kg * 0.3048 m/s², 1 psi = 1 lbf / (0.0254 m)².
@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.35%. Comparing base (cbf084c) to head (1fd067c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #898      +/-   ##
==========================================
+ Coverage   94.31%   94.35%   +0.03%     
==========================================
  Files          29       29              
  Lines         176      177       +1     
  Branches       39       39              
==========================================
+ Hits          166      167       +1     
  Misses         10       10              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Nov 22, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing bardrop-oss:fix/exact-pound-force (1fd067c) with main (cbf084c)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant