Projects / units

units

GNU units converts quantities expressed in various systems of measurement to their equivalents in other systems of measurement. Like many similar programs, it can handle multiplicative scale changes. It can also handle nonlinear conversions such as Fahrenheit to Celsius, and it can perform conversions from and to sums of units, such as converting between feet plus inches and meters. Beyond simple unit conversions, units can be used as a general-purpose scientific calculator which keeps track of units in its calculations. You can form arbitrary complex mathematical expressions of dimensions including sums, products, quotients, powers, and even roots of dimensions. In this way, you can ensure accuracy and dimensional consistency when working with long expressions which involve many different units which may combine in complex ways. The units are defined in an extensive, well-annotated data file which defines over 2,500 units. You can also provide your own file to supplement or replace the standard file.

Tags
Licenses
Operating Systems
Implementation

Recent releases

  •  29 Mar 2014 16:35

    Release Notes: This version supports '_' to represent the previous result and support for rational exponents. Output can be logged to a file with -L. Nonlinear unit synonyms are easier to define, and display of nonlinear unit definitions now shows the range and domain and type of units needed. Error handling is better, and various bugs have been fixed.

    •  31 Oct 2012 10:29

      Release Notes: This release corrects an electron mass error.

      •  30 Jun 2012 15:59

        Release Notes: This release supports conversion to sums of units (e.g., feet and inches or hours and minutes). It includes a script to automatically update the currency conversion rates. The units are now in Unicode with UTF-8. Units can be defined with reference to environment variables, so you can now select local units such as the gallon without changing locale, and these units will work everywhere. The name of the units database has changed, and the syntax for defining nonlinear units has changed slightly to allow specification of domain and range. The personal units database is now $HOME/.units.

        •  16 Feb 2010 03:19

          Release Notes: The units database has been updated to include the latest NIST values, abrasive grits, and other fixes.

          •  27 Sep 2007 09:18

            Release Notes: Units now reads custom definitions from ~/.units.dat. The precedence of "*" has changed to match the usual algebraic precedence, and the "**" operator was added for exponents. A text search feature was added so that typing "search text" lists the units whose names contain "text".

            Recent comments

            14 Jun 2005 04:30 emh

            Re: non-linear?
            A linear function is of the form f(x) = ax + b, while a linear transformation satisfies T(a + b) = T(a) + T(b). So the "function" is linear, but the "transformation" is not. Of course, the function and the transformation is the same, so it depends on the context which one applies. A transformation is obviously what the units developers had in mind, and that is probably natural given that units are transformed to other units.

            20 Jun 2002 07:52 adrianmariano

            Re: non-linear?

            > Fahrenheit <-> Celsius is a
            > perfectly linear conversion:
            >
            > T[C] = (T[F]-32)/1.8


            No, it is an affine transformation, not a linear one because of the constant offset. If F is a linear transformation then it must satisfy the property F(a+b)=F(a)+F(b). This is clearly false for the above temperature conversion. For example 32 degrees Fahrenheit is 0 degrees Celsius but 32+32=64 degrees Fahrenheit is not 0+0=0 degrees Celsius.

            20 Jun 2002 04:21 murdegern

            non-linear?
            Maybe this is nit-picking, but Fahrenheit <-> Celsius is a perfectly linear conversion:

            T[C] = (T[F]-32)/1.8

            non-linear would be Energy to Wavelength, for example.

            Screenshot

            Project Spotlight

            OpenStack4j

            A Fluent OpenStack client API for Java.

            Screenshot

            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.