Units (software)
   HOME

TheInfoList



OR:

GNU Units is a
cross-platform In computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform software ...
computer program A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components. A computer program ...
for
conversion of units Conversion of units is the conversion between different units of measurement for the same quantity, typically through multiplicative conversion factors which change the measured quantity value without changing its effects. Overview The process ...
of quantities. It has a database of measurement units, including
esoteric Western esotericism, also known as esotericism, esoterism, and sometimes the Western mystery tradition, is a term scholars use to categorise a wide range of loosely related ideas and movements that developed within Western society. These ideas ...
and historical units. This for instance allows conversion of velocities specified in
furlong A furlong is a measure of distance in imperial units and United States customary units equal to one eighth of a mile, equivalent to 660 feet, 220 yards, 40 rods, 10 chains or approximately 201 metres. It is now mostly confined to use in hor ...
s per
fortnight A fortnight is a unit of time equal to 14 days (two weeks). The word derives from the Old English term , meaning "" (or "fourteen days," since the Anglo-Saxons counted by nights). Astronomy and tides In astronomy, a ''lunar fortnight'' is ha ...
, and pressures specified in
ton Ton is the name of any one of several units of measure. It has a long history and has acquired several meanings and uses. Mainly it describes units of weight. Confusion can arise because ''ton'' can mean * the long ton, which is 2,240 pounds ...
s per acre. Output units are checked for consistency with the input, allowing verification of conversion of complex expressions.


History

GNU Units was written by Adrian Mariano as an implementation of the ''
units Unit may refer to: Arts and entertainment * UNIT, a fictional military organization in the science fiction television series ''Doctor Who'' * Unit of action, a discrete piece of action (or beat) in a theatrical presentation Music * Unit (album), ...
'' utility included with the
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, an ...
operating system. It was originally available under a permissive license. The GNU variant is distributed under the GPL although the FreeBSD project maintains a free fork of units from before the license change.


''units'' (Unix utility)

The original ''units'' program has been a standard part of Unix since the early
Bell Laboratories Nokia Bell Labs, originally named Bell Telephone Laboratories (1925–1984), then AT&T Bell Laboratories (1984–1996) and Bell Labs Innovations (1996–2007), is an American industrial research and scientific development company owned by mult ...
versions. Source code for a version very similar to the original is available from the
Heirloom Project The Heirloom Project is a collection of traditional Unix utilities. Most of them are derived from original Unix source code, as released as open-source by Caldera and Sun. The project has the following components: * The Heirloom Toolchest: awk, ...
.


The GNU implementation

GNU ''units'' includes several extensions to the original version, including * Exponents can be written with ^ or **. * Exponents can be larger than 9 if written with ^ or **. * Rational and decimal exponents are supported. * Sums of units (e.g., ) can be converted. * Conversions can be made ''to'' sums of units, termed ''unit lists'' (e.g., from degrees to degrees, minutes, and seconds). * Units that measure reciprocal dimensions can be converted (e.g., S to megohm). * Parentheses for grouping are supported. This sometimes allows more natural expressions, such as in the example given in
Complex units expressions Complex commonly refers to: * Complexity, the behaviour of a system whose components interact in multiple ways so possible interactions are difficult to describe ** Complex system, a system composed of many components which may interact with each ...
. * Roots of units (e.g., can be computed. * Nonlinear units conversions (e.g., °F to °C) are supported. * Functions such as sin, cos, ln, log, and log2 are included. * A script for updating the currency conversions is included; the script requires
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
. Units definitions, including nonlinear conversions and unit lists, are user extensible. The
plain text In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects (floating-point numbers, images, etc.). It may also include a limit ...
database ''definitions.units'' is a good reference in itself, as it is extensively commented and cites numerous sources.


Other implementations

''UDUNITS'' is a similar utility program, except that it has an additional programming
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
interface and date conversion abilities. UDUNITS is considered the ''de facto'' program and library for variable unit conversion for
netCDF NetCDF (Network Common Data Form) is a set of software libraries and self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. The project homepage is hosted by the Unidat ...
files.


Version history

GNU Units version 2.19 was released on 31 May 2019, to reflect the new 2019 revision of the SI; Version 2.14 released on 8 March 2017 fixed several minor bugs and improved support for building on Windows. Version 2.10, released on 26 March 2014, added support for rational exponents greater than one, and added the ability to save an interactive session in a file to provide a record of the conversions performed. Beginning with version 2.10, a 32-bit Windows binary distribution has been available on the project Web page (a 32-bit Windows port of version 1.87 has been available since 2008 as part of the
GnuWin32 The G''nu''W''in''32 project provides native ports in the form of executable computer programs, patches, and source code for various GNU and open source tools and software, much of it modified to run on the 32-bit Windows platform. The ports in ...
project). Version 2.02, released on 11 July 2013, added hexadecimal floating-point output and two other options to simplify changing the output format. Version 2.0, released on 2 July 2012, added the ability to convert to sums of units, such as hours and minutes or feet and inches. In addition, this release added support for UTF-8 encoding. Provision for locale-specific unit definitions was added. The syntax for defining non-linear units was changed, and added optional domain and range specifications. The names of the standard and personal units data files were changed, and the currency definitions were placed in a separate data file; a Python script for updating the currency definitions was added. The version history is covered in detail in the NEWS file included with the source distribution.


Usage

''Units'' will output the result of the conversion in two lines. Usually, the first line (multiplication) is the desired result; the second line is the same conversion expressed as a division. ''Units'' can also function as a general-purpose scientific calculator; it includes several built-in mathematical functions such as
sin In a religious context, sin is a transgression against divine law. Each culture has its own interpretation of what it means to commit a sin. While sins are generally considered actions, any thought, word, or act considered immoral, selfish, s ...
, cos,
atan Atan may refer to: Places * Atan, Armenia * Atan, Iran People * Atan Shansonga (born 1955), Zambian diplomat * Çağdaş Atan, Turkish footballer * Cem Atan, Turkish footballer Other * Attan, a Pashtun and Afghan traditional dance * arctang ...
, ln,
exp Exp may stand for: * Exponential function The exponential function is a mathematical function denoted by f(x)=\exp(x) or e^x (where the argument is written as an exponent). Unless otherwise specified, the term generally refers to the pos ...
, etc. Attempting to convert types of measurements that are incompatible will cause ''units'' to print a conformability error message and display a reduced form of each measurement.


Examples

The examples that follow show results from GNU ''units'' version 2.10.


Interactive mode

Currency exchange rates from www.timegenie.com on 2014-03-28
2729 units, 92 prefixes, 77 nonlinear units

You have: 10 furlongs
You want: miles
        * 1.25
        / 0.8
You have: 1 gallon + 3 pints
You want: quarts
        * 5.5
        / 0.18181818
You have: sqrt(meter)
                    ^
Unit not a root
You have: sqrt(acre)
You want: ft
        * 208.71033
        / 0.0047913298
You have: 21 btu + 6500 ft lbf
You want: btu
        * 29.352939
        / 0.034068139
You have: _
You want: J
        * 30968.99
        / 3.2290366e-005
You have: 3.277 hr
You want: time
        3 hr + 16 min + 37.2 sec
You have: 1, 2 inch
You want: cm
        * 1.27
        / 0.78740157
The underscore ('_') is used to indicate the result of the last successful unit conversion.


On the command line (non-interactive)

C:\>units "ten furlongs per fortnight" "kilometers per hour" * 0.0059871429 / 167.02458 % units cup ounces conformability error 0.00023658824 m^3 0.028349523 kg


Complex units expressions

One form of the
Darcy–Weisbach equation In fluid dynamics, the Darcy–Weisbach equation is an empirical equation that relates the head loss, or pressure loss, due to friction along a given length of pipe to the average velocity of the fluid flow for an incompressible fluid. The equation ...
for fluid flow is :\Delta P = \frac \rho fL \frac \,, where Δ''P'' is the pressure drop, ''ρ'' is the mass density, ''f'' is the (dimensionless) friction factor, ''L'' is the length of the pipe, ''Q'' is the volumetric flow rate, and ''d'' is the pipe diameter. It might be desirable to have the equation in the form :\Delta P = A_1 \,\rho fL \frac that would accept typical US units; the constant ''A''1 could be determined manually using the unit-factor method, but it could be determined more quickly and easily using ''units'': $ units "(8/pi^2)(lbm/ft^3)ft(ft^3/s)^2(1/in^5)" psi * 43.533969 / 0.022970568 Crane Technical Paper No. 410, Eq. 3-5, gives the multiplicative value as 43.5.


See also

*
Unified Code for Units of Measure The Unified Code for Units of Measure (UCUM) is a system of codes for unambiguously representing measurement units. Its primary purpose is machine-to-machine communication rather than communication between humans. The code set includes all units de ...


Notes


References


External links

*{{Official website
Linux man page for unitsJava version of GNU unitsunits source
from the
Heirloom Project The Heirloom Project is a collection of traditional Unix utilities. Most of them are derived from original Unix source code, as released as open-source by Caldera and Sun. The project has the following components: * The Heirloom Toolchest: awk, ...

Online units converter based on GNU unitsA simple online converter based on GNU unitsUDUNITS
Cross-platform software Unix software
Units Unit may refer to: Arts and entertainment * UNIT, a fictional military organization in the science fiction television series ''Doctor Who'' * Unit of action, a discrete piece of action (or beat) in a theatrical presentation Music * Unit (album), ...
Free mathematics software Units of measurement