Skip to content

Instantly share code, notes, and snippets.

@CodeDrome
Created July 9, 2021 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeDrome/73e5b951337b33f29b1dcf5fb3e1a8fc to your computer and use it in GitHub Desktop.
Save CodeDrome/73e5b951337b33f29b1dcf5fb3e1a8fc to your computer and use it in GitHub Desktop.
mathjsunits10.js
function bitsAndBytes()
{
const bits = math.unit(64, 'bits');
const bytes = bits.to('bytes');
const kilobytes = math.unit(1024, 'bytes');
output(`bits: ${bits}`);
output(`bytes: ${bytes}`);
output(`kilobytes: ${kilobytes}`);
output(`kilobytes to kibibytes: ${kilobytes.to('kibibytes')}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment