Skip to content

Commit

Permalink
fix(volume): fix imperial conversion ratios
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider committed Dec 24, 2020
1 parent 3bd1dc4 commit cd447b5
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 57 deletions.
106 changes: 51 additions & 55 deletions src/conversions/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,64 +167,60 @@ export const volume = {
cuin: ratioer(1.6e-1),
in3: ratioer(1.6e-1),

'measurement ton': ratioer(1.2),
'measurement tons': ratioer(1.2),
MTON: ratioer(1.2),
'measurement ton': ratioer(1.133),
'measurement tons': ratioer(1.133),
MTON: ratioer(1.133),
//#endregion

//#region Imperial
'imperial barrel': ratioer(160),
'imperial barrels': ratioer(160),
'imp bbl': ratioer(160),
impbbl: ratioer(160),

kilderkin: ratioer(160),
kilderkins: ratioer(160),

firkin: ratioer(160),
firkins: ratioer(160),

'imperial bushel': ratioer(160),
'imperial bushels': ratioer(160),
'imp bsh': ratioer(160),
'imp bu': ratioer(160),
impbsh: ratioer(160),
impbu: ratioer(160),

'imperial kenning': ratioer(18),
'imperial kennings': ratioer(18),
kenning: ratioer(18),
impkenning: ratioer(18),

'imperial peck': ratioer(9.1),
'imperial pecks': ratioer(9.1),
pk: ratioer(9.1),
imppk: ratioer(9.1),

'imperial quart': ratioer(1.1),
'imperial quarts': ratioer(1.1),
'imp qt': ratioer(1.1),
impqt: ratioer(1.1),

'imperial gallon': ratioer(1 / 219.9692),
'imperial gallons': ratioer(1 / 219.9692),
'imp gal': ratioer(1 / 219.9692),
impgal: ratioer(1 / 219.9692),

'imperial pint': ratioer(0.57),
'imperial pints': ratioer(0.57),
'imp pt': ratioer(0.57),
imppt: ratioer(0.57),

gill: ratioer(4.8),
gills: ratioer(4.8),
gi: ratioer(4.8),
impgi: ratioer(4.8),

'imperial fluid ounce': ratioer(123),
'imperial fluid ounces': ratioer(123),
'imp fl oz': ratioer(123),
impoz: ratioer(123),
// https://en.wikipedia.org/wiki/Imperial_units#Volume
'imperial barrel': ratioer(0.16),
'imperial barrels': ratioer(0.16),
'imp bbl': ratioer(0.16),
impbbl: ratioer(0.16),

kilderkin: ratioer(0.08318),
kilderkins: ratioer(0.08318),

firkin: ratioer(0.041),
firkins: ratioer(0.041),

'imperial bushel': ratioer(0.03636872),
'imperial bushels': ratioer(0.03636872),
'imp bsh': ratioer(0.03636872),
'imp bu': ratioer(0.03636872),
impbsh: ratioer(0.03636872),
impbu: ratioer(0.03636872),

'imperial peck': ratioer(0.00909218),
'imperial pecks': ratioer(0.00909218),
pk: ratioer(0.00909218),
imppk: ratioer(0.00909218),

'imperial quart': ratioer(0.0011365225e12),
'imperial quarts': ratioer(0.0011365225e12),
'imp qt': ratioer(0.0011365225e12),
impqt: ratioer(0.0011365225e12),

'imperial gallon': ratioer(0.00454609e12),
'imperial gallons': ratioer(0.00454609e12),
'imp gal': ratioer(0.00454609e12),
impgal: ratioer(0.00454609e12),

'imperial pint': ratioer(0.00056826125e12),
'imperial pints': ratioer(0.00056826125e12),
'imp pt': ratioer(0.00056826125e12),
imppt: ratioer(0.00056826125e12),

gill: ratioer(0.0001420653125e12),
gills: ratioer(0.0001420653125e12),
gi: ratioer(0.0001420653125e12),
impgi: ratioer(0.0001420653125e12),

'imperial fluid ounce': ratioer(2.84130625e7),
'imperial fluid ounces': ratioer(2.84130625e7),
'imp fl oz': ratioer(2.84130625e7),
impoz: ratioer(2.84130625e7),
//#endregion

//#region US customary liquid measure
Expand Down
8 changes: 6 additions & 2 deletions test/conversions/volume.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('volume', () => {
convertAssert(1, 'cubic foot', 0.028, 'm3');
convertAssert(1, 'board foot', 0.002359737, 'm3');
convertAssert(1, 'cubic inch', 16, 'cm3');
convertAssert(1, 'measurement ton', 1.2, 'm3');
convertAssert(1, 'measurement ton', 1.133, 'm3');

convertAssert(6.2898, 'oilbbl', 1, 'm3', true);
convertAssert(0.0238, 'bbl', 1, 'US gallon', true);
Expand All @@ -31,5 +31,9 @@ describe('volume', () => {
convertAssert(1, 'US dry quart', 0.946352946, 'liters');
convertAssert(1, 'US dry pint', 33.6003125, 'm3');

convertAssert(219.9692, 'imperial gallons', 1, 'm3');
convertAssert(1, 'imperial fluid ounces', 28.4130625, 'ml');
convertAssert(1, 'gill', 142.0653125, 'ml');
convertAssert(1, 'imperial pints', 568.26125, 'ml');
convertAssert(1, 'imperial quarts', 1136.5225, 'ml');
convertAssert(1, 'imperial gallons', 4546.09, 'ml');
});

0 comments on commit cd447b5

Please sign in to comment.