Units of Measure
A unit of measure is a specification that uses numbers to tell you about a physical quantity. You can compare two quantities only if they have the same unit. If they have different units, then you must change one to the other. When you change a unit, then you must change the number, usually by multiplication.
For a very long time, different cultures used different units for the same dimensions. Frequently they could not agree how to change between units.
Most cultures at this time use the metric system. But Myanmar, Liberia, and the USA reject it. Also, The UK uses it less than other parts of Europe. But also those using the metric system can disagree on how much resolution is necessary, for example 1.5 seconds compared to 1500 milliseconds.
ViviFire lets you identify units of measure. With this comes compile-time checks of correctness and automatic changes of values to the necessary units.
How a physical quantity shows is almost the same as that used in standard print. You write a floating-point number, then a unit. If the unit is one word, then you can write it without punctuation. But if it is more than one word, then you must write the unit between parentheses. Names of units do not ignore letter case. This is the only part of ViviFire where this occurs.
You can specify multiplication in two styles.
You can write names with spaces between them, which occurs frequently in mathematics.
Or you can use an asterisk (
You can write division in only one style.
You use a forward slash (
Some examples folow.
height = (443.2 meters circumference = 40_075.017 km power1 = 3.6 megajoules power2 = 2.0 (kilowatt*hours) power3 = 3.0 (kW h) speed1 = 343.0 (meters/second) speed2 = 1_480.0 (m/s)
A base unit is a unit to measure a physical quantity that has no relation to other units. The SI base units are meter, kilogram, second, ampere, Kelvin, mole, and candela.
Base Unit length In meters Base Unit mass In kilograms Base Unit time In seconds Base Unit electric_current In amperes Base Unit temperature In Kelvin Base Unit amount_of_substance In moles Base Unit luminous_intensity In candelas
Base Unit velocity In (meters/second)
Alternative names and SI prefixes
Units can have many interchangable names. For example, “km” is short for “kilometer” or “kilometre”.
To make alternative names, write each name with spaces between them. To make the plural of a name, write the plural suffix after a plus sign.
To specify that a unit is an SI unit, put the modifier
@SI before the keyword
This automatically makes all names with the SI prefixes of magnitude.
For a one-letter name, it adds the short prefixes, for example, “k”.
For longer names, it uses the full prefixes, for example, “kilo”.
Different units can have the same name if each unit has a different base unit.
But when this occurs, you cannot use these units to make a variable or parameter to a procedure with the keyword
You can try to make units that do not have the same name, or use a different alternative name.
@SI Unit meter+s metre+s m
The above statement makes the units that follow:
- meter, yottameter, zettameter, exameter, petameter, terameter, gigameter, megameter, kilometer, hectometer, decameter, decimeter, centimeter, millimeter, micrometer, nanometer, picometer, femtometer, attometer, zeptometer, and yoctometer
- meters, yottameters, zettameters, exameters, petameters, terameters, gigameters, megameters, kilometers, hectometers, decameters, decimeters, centimeters, millimeters, micrometers, nanometers, picometers, femtometers, attometers, zeptometers, and yoctometers
- metre, yottametre, zettametre, exametre, petametre, terametre, gigametre, megametre, kilometre, hectometre, decametre, decimetre, centimetre, millimetre, micrometre, nanometre, picometre, femtometre, attometre, zeptometre, and yoctometre
- metres, yottametres, zettametres, exametres, petametres, terametres, gigametres, megametres, kilometres, hectometres, decametres, decimetres, centimetres, millimetres, micrometres, nanometres, picometres, femtometres, attometres, zeptometres, and yoctometres
- m, Ym, Zm, Em, Pm, Tm, Gm, Mm, km, hm, dam, dm, cm, mm, µm, um, nm, pm, fm, am, zm, and ym.
Units with interval scales
Unit Kelvin K Unit (k In Kelvin) degree_C degrees_C = k + 273.15
Measure types and variables
Var height In meters
height = 6 feet