SI -- A Scala Library of Units of Measurement

Submitted by h2b on
Produktinformationen
Name
SI
Version
1.0.0
Programming language
Scala (2.12, 2.11)
Date

This is a Scala library of units of measurement featuring the International System of Units (SI).

The main types defined are Quantity and Unit.

A quantity is composed of a magnitude and a unit. It provides arithmetic operations where -- in many cases -- the system is smart enough to derive the correct type of the result: for instance, a quantity which unit has been computed to be mass * ((length / time) / time) automatically becomes a quantity of force unit. There are also nice shortcuts that, e.g.,  allow a Quantity(10, metre) to be written as 10.m.

Unit classes are provided for the seven SI base units along with associated objects of common names like metre, kilogram, second and so on. Furthermore, a (of course not complete) bunch of derived SI units like squareMetre, newton, pascal, joule, watt or volt is supported. The Prefix class has case objects providing the usual SI prefixes like kilo or milli along with a multiplication operation for units.

Verweise
Bereich
Tags