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

SI Units Authors

SI Units

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 unitBase unit equivalent
rad1
sr1
Hzs^-1
Nkg m s^-2
Pakg m^-1 s^-2
Jkg m^2 s^-2
Derived unitBase unit equivalent
Wkg m^2 s^-3
CA s
Vkg m^2 s^-3 A^-1
Fkg^-1 m^-2 s^4 A^2
Ωkg m^2 s^-3 A^-2
Skg^-1 m^-2 s^3 A^2
Derived unitBase unit equivalent
Wbkg m^2 s^-2 A^-1
Tkg s^-2 A^-1
Hkg m^2 s^-2 A^-2
°CK
lmcd
lxcd m^-2
Derived unitBase unit equivalent
Bqs^-1
Gym^2 s^-2
Svm^2 s^-2
katmol s^-1

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

SymbolFactor
Q10^30
R10^27
Y10^24
Z10^21
E10^18
P10^15
SymbolFactor
T10^12
G10^9
M10^6
k10^3
h10^2
da10^1
SymbolFactor
d10^-1
c10^-2
m10^-3
μ10^-6
n10^-9
p10^-12
SymbolFactor
f10^-15
a10^-18
z10^-21
y10^-24
r10^-27
q10^-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).
Copied
0 bytes, 0 chars
Restore solution
All
Compiled from AT&T syntax to x86-64 Linux. Use syscalls to write output.
Fennel 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 seperate 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.