Wilang Documentation1.0.0+4

Units and conversions#

Create and convert values#

Write a number followed by a unit, or call unit with a string. Use to or in to convert between compatible units.

Example
to(5 inch,cm)
Example
90 km/h to m/s
0.5 kg + 33 g
9.81 m/s^2 * 3 s
number(5 cm,mm)

Units combine with multiplication, division, and powers. Convert like with like, so length to length and mass to mass. Incompatible dimensions fail. To get a plain number in a given unit, use number(value, targetUnit).

Names, aliases, and prefixes#

Names are case-sensitive. m is metre, while M is the mega prefix rather than another spelling. Prefixes attach directly to give km, mm, kPa, and MiB. The prefixes each unit accepts vary, so see All units for the complete table along with aliases and plural names.

Temperature#

Celsius and Fahrenheit are offset scales, so convert them rather than treating a reading as a plain scale factor.

Example
20 celsius to fahrenheit
300 K to celsius

Avoid multiplying absolute Celsius or Fahrenheit readings in a physical formula. Convert to Kelvin when you need an absolute temperature, and keep a temperature reading distinct from a temperature difference.

Angles and numeric types#

The direct trig functions accept an angle unit. The inverse trig functions return a number, so attach radians before you convert.

Example
sin(45 deg)
(asin(0.5) rad) to deg

Set the numeric default in Math settings. math.config(...) is JavaScript API syntax and is not available in a cell. Where the overloads support units, an explicit fraction or bignumber constructor is useful.

Custom units and splitting#

For a definition that persists, use Global Variables → custom units. A direct createUnit call modifies the shared runtime, which makes it a full-app recipe rather than an isolated interactive example.

splitUnit expresses a value in a list of compatible units, and toBest picks a suitable scale. See their references for the accepted syntax.

All units · All functions