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, you must change one to the other. When you change a unit, 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 the USA does not use it much. And Myanmar, Liberia, Canada, and the UK are slow to use it.
But also those who use the metric system can argue about how much resolution is necessary. For example, to use 1.5 seconds or 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, you can write it without punctuation. But if it is more than one word, also knows as a compound unit, 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)
duration1 = 3 hrs 5 mins duration2 = 1 week 3 days 5 hrs 7 mins 9.11 secs length = 8 m 1 mm
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 a regular plural of a name, write the plural suffix after a plus symbol (
To make an irregular plural, write the number
1 before the singular and
2 before the plural.
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.
Example: irregular plural
Unit 1 foot 2 feet ft = 12 inches
Example: SI unit
@SI Unit meter+s metre+s m
The above statement makes the 131 units that follow:
- (singular) meter
- (large) decameter, dekameter, hectometer, kilometer, megameter, gigameter, terameter, petameter, exameter, zettameter, yottameter, ronnameter, quettameter
- (small) decimeter, centimeter, millimeter, micrometer, nanometer, picometer, femtometer, attometer, zeptometer, yoctometer, rontometer, quectometer
- (plural) meters
- (large) decameters, dekameters, hectometers, kilometers, megameters, gigameters, terameters, petameters, exameters, zettameters, yottameters, ronnameters, quettameters
- (small) decimeters, centimeters, millimeters, micrometers, nanometers, picometers, femtometers, attometers, zeptometers, yoctometers, rontometers, quectometers
- (singular) metre
- (large) decametre, dekametre, hectometre, kilometre, megametre, gigametre, terametre, petametre, exametre, zettametre, yottametre, ronnametre, quettametre
- (small) decimetre, centimetre, millimetre, micrometre, nanometre, picometre, femtometre, attometre, zeptometre, yoctometre, rontometre, quectometre
- (plural) metres
- (large) decametres, dekametres, hectometres, kilometres, megametres, gigametres, terametres, petametres, exametres, zettametres, yottametres, ronnametres, quettametres
- (small) decimetres, centimetres, millimetres, micrometres, nanometres, picometres, femtometres, attometres, zeptometres, yoctometres, rontometres, quectometres
- (large) dam, hm, km, Mm, Gm, Tm, Pm, Em, Zm, Ym, Rm, Qm
- (small) dm, cm, mm, µm, μm, um, nm, pm, fm, am, zm, ym, rm, qm
Units with interval scales
Unit Kelvin K Unit Celsius 1 degree_C 2 degrees_C (k In Kelvin) = k + 273.15
Measure types and variables
Var height In meters
height = 6 feet