gs

Please in order to save solutions and appear on the leaderboards.

Details

The International System of Units (SI) defines 7 base units: s (second), m (meter), kg (kilogram), A (ampere), K (kelvin), mol (mole) and cd (candela). In addition to base units, there are 22 derived units, which can all be represented as products of powers of these base units.

Derived unit Base unit equivalent
rad 1
sr 1
Hz s^-1
N kg m s^-2
Pa kg m^-1 s^-2
J kg m^2 s^-2
Derived unit Base unit equivalent
W kg m^2 s^-3
C A s
V kg m^2 s^-3 A^-1
F kg^-1 m^-2 s^4 A^2
Ω kg m^2 s^-3 A^-2
S kg^-1 m^-2 s^3 A^2
Derived unit Base unit equivalent
Wb kg m^2 s^-2 A^-1
T kg s^-2 A^-1
H kg m^2 s^-2 A^-2
°C K
lm cd
lx cd m^-2
Derived unit Base unit equivalent
Bq s^-1
Gy m^2 s^-2
Sv m^2 s^-2
kat mol s^-1

SI also defines 24 symbols known as prefixes, denoting powers of ten.

Symbol Factor
Q 10^30
R 10^27
Y 10^24
Z 10^21
E 10^18
P 10^15
Symbol Factor
T 10^12
G 10^9
M 10^6
k 10^3
h 10^2
da 10^1
Symbol Factor
d 10^-1
c 10^-2
m 10^-3
μ 10^-6
n 10^-9
p 10^-12
Symbol Factor
f 10^-15
a 10^-18
z 10^-21
y 10^-24
r 10^-27
q 10^-30

Each argument is an SI unit with a possible prefix. Print it as a product of a power of ten and its base units. For example, GW (gigawatt) becomes 10^9 kg m^2 s^-3. Keep in mind the following exceptions:

  • The kilogram is a base unit with an inherent prefix. Other prefixes attach to g (gram), and you should print their values relative to the kilogram: g is 10^-3 kg and Mg is 10^3 kg.
  • Instead of 10^1, print 10.
  • Instead of 10^0, print 1.
  • For rad and sr, only print a power of ten. (Example: for Mrad, print 10^6, not 10^6 1.)
  • There is no universal order among the base units. For C, you must output A s rather than s A. We follow the conventions of NIST.
  • μ is U+03BC GREEK SMALL LETTER MU (UTF-8: ce bc).
  • Ω is U+03A9 GREEK CAPITAL LETTER OMEGA (UTF-8: ce a9).
  • ° is U+00B0 DEGREE SIGN (UTF-8: c2 b0).

External links: NIST (Prefixes), NIST (Units)

Copied
0 bytes, 0 chars
Restore solution
All
Compiled from AT&T syntax to x86-64 Linux. Use syscalls to write output.
Arturo is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Befunge is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
BQN is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
CoffeeScript is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Fennel is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Gleam is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Hare is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Haxe is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Hush is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Hy is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Odin is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Racket is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Rebol is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Rexx is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Rockstar 2 is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
Uiua is an experimental language, no solutions will be saved. Please leave feedback on the GitHub issue.
ctrl + enter or

Delete Solution

Are you sure you want to delete your solution(s) for SI Units?

If you have separate bytes and chars solutions then both will be deleted.

This is irreversible, please backup any code you care about.

Type I understand and press confirm to continue.