thx.unit 0.8.0

Library for unit of measurements. So far are included linear measurement, amount of substance, angle, current, digital, luminous intensity, mass, and time.

Released 2016-12-22.

To install, run:

haxelib install thx.unit 0.8.0

See using Haxelib in Haxelib documentation for more information.

Maintainerfponticelli
Websitehttps://github.com/fponticelli/thx.unit
Current version0.8.0
StatisticsInstalled 232 times
LicenseMIT
Tags cross, dimension, math, thx, unit

README.md

thx.unit

Build Status

The library contains type definitions for several kind of units. They are defined as asbtract types to simplify their usage as much as possible.

(10 : Millimetre) * 100 == (1 : Metre);
// other example
var f = (27 : Celsius).toFahrenheit()

The following units are currently supported:

For now the library essentially helps with conversions and math operations. At some point derivative units might be introduced to make things more interesting.

Also notice that the types are automatically generated. If you want to contribute to the library make sure to make changes in the definitions. The code is generated using this generator.

The library has not been exhaustively tested, please pay attention to the correctness of the results you get.

Important. This library should be used with the knowledge that converting values and perform some operations on the values might result in loss of precision. The limitation come from the fact that the underlying type is Float. Converting LightYears to Millimitres might not work as well as you expect!

install

From the command line just type:

haxelib install thx.unit

To use the dev version do:

haxelib git thx.core https://github.com/fponticelli/thx.unit.git