[READ-ONLY] Mirror of https://github.com/probablykasper/cpc. Text calculator with support for units and conversion cpc.kasper.space
calculator cli conversion converter library math package units units-converter wasm website
0

Configure Feed

Select the types of activity you want to include in your feed.

Added unit of mass `stone`

Kasper (Nov 26, 2020, 6:28 PM +0100) 72037bfd dcc948b5

+3
+1
src/lexer.rs
··· 277 277 } 278 278 } 279 279 }, 280 + "stone" | "stones" => tokens.push(Token::Unit(Stone)), 280 281 "st" | "ton" | "tons" | "short ton" | "short tons" | "short tonne" | "short tonnes" => tokens.push(Token::Unit(ShortTon)), 281 282 "lt" | "long ton" | "long tons" | "long tonne" | "long tonnes" => tokens.push(Token::Unit(LongTon)), 282 283
+2
src/units.rs
··· 148 148 MetricTon: (Mass, d128!(1000000)), 149 149 Ounce: (Mass, d128!(28.349523125)), 150 150 Pound: (Mass, d128!(453.59237)), 151 + Stone: (Mass, d128!(6350.29318)), 151 152 ShortTon: (Mass, d128!(907184.74)), 152 153 LongTon: (Mass, d128!(1016046.9088)), 153 154 ··· 769 770 assert_eq!(convert_test(1000.0, Kilogram, MetricTon), 1.0); 770 771 assert_eq!(convert_test(0.45359237, Kilogram, Pound), 1.0); 771 772 assert_eq!(convert_test(16.0, Ounce, Pound), 1.0); 773 + assert_eq!(convert_test(14.0, Pound, Stone), 1.0); 772 774 assert_eq!(convert_test(2000.0, Pound, ShortTon), 1.0); 773 775 assert_eq!(convert_test(2240.0, Pound, LongTon), 1.0); 774 776