Created
July 9, 2021 17:30
-
-
Save CodeDrome/e7da24f1aa1923c0bd376510d246dbc5 to your computer and use it in GitHub Desktop.
mathjsunits09.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gallons() | |
{ | |
// create imperial gallon unit | |
math.createUnit('impgal', '4.54609 liter'); | |
// could do this, but probably not advisable! | |
// math.createUnit('gallon', '4.54609 liter', {override: true}) | |
const usgallon = math.unit(1, 'gallon'); | |
output(`usgallon: ${usgallon}`); | |
output(`usgallon.to('liter'): ${usgallon.to('liter')}`); | |
output("<br>"); | |
const impgallon = math.unit(1, 'impgal'); | |
output(`impgallon: ${impgallon}`); | |
output(`impgallon.to('liter'): ${impgallon.to('liter')}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment