# 4. Units and Conversions

Some functions do not take any argument and return constant values that represent units of measurement. They include units of the SI system of measurement used internationally and which, by international agreement, have a value of 1. The unit of time is the second, the unit of length is the meter, the unit of mass is the kilogram, and so on.

second = 1

meter = 1

kg = 1

Other unit functions return values defined by reference to these basic SI units. AddUp defines many of these for commonly-used measures, all expressed in SI units:

minute = 60

day = 86,400

pound = 0.45359

mile = 1,609.344

Functions minute and day return the number of seconds (the unit of time) in a minute and a day. Function pound gives the number of kilograms (the unit of mass) in a pound. Function mile gives the number of meters (the unit of length) in a mile.

Unit values can be directly used in expressions. The number of seconds in three weeks is:

3 * week = 1,814,400

Multiplications are implied when the multiplication operator is omited before the name of a function. This means what we can also write:

3 weeks = 1,814,400

Operations that involve units, even different units, can be combined:

3 weeks + 2 days = 1,987,200

Since unit functions return values expressed in the relevant SI unit, the above result represents a number of seconds. AddUp 2 implements a -> conversion operator (as well as a convert function) that lets you get a result in the units you actually need. You can convert the above result in hours instead of seconds:

(3 weeks + 2 days) -> hours = 552

You can also use the conversion operator to convert units from one measurement system to another. Convert thirty degrees Celsius to Fahrenheit, convert thirty degrees of angle to radians:

30 C -> F = 86

30 deg -> rad = 0.5236

Unit functions coupled with the conversion operator provide a convenient way to handle measurement units of all sorts.

<< Back to the overview.