Skip to content

acidus-effect/dotnet-quantify-length

Repository files navigation

Quantify.Length ci branch parameter

Quantify.Length makes it easy to work with lengths, when multiple different units are involved.

var lengthInKilometers = Length.Create(11.2, Unit.Kilometre);
var lengthInMiles = Length.Create(5, Unit.Mile);

var totalLengthInKilometers = lengthInKilometers + lengthInMiles;

For more information about the Quantify framework and what features are available, please see Quantify.

Length and PreciseLength

Quantify.Length contains two different class for working with lengths.

Length stores the quantity values as a double. This means that class is optimized towards performace instead of precision. As a result of this round-off errors might occur.

PreciseLength stores the quantity value as a decimal, which is optimized towards precision instead of performance. The consequence of this is a slight performance hit when doing calculations, but round-off errors are avoided.

Supported Units

The following units are supported in the latest version. The units can also be found in Unit.

SI Imperial Typographic (Planned) Astronomical (Planned)
  • Yoctometre
  • Zeptometre
  • Attometre
  • Femtometre
  • Picometre
  • Nanometre
  • Micrometre
  • Millimetre
  • Centimetre
  • Decimetre
  • Metre
  • Decametre
  • Hectometre
  • Kilometre
  • Megametre
  • Gigametre
  • Terametre
  • Petametre
  • Exametre
  • Zettametre
  • Yottametre
  • Thou
  • Inch
  • Foot
  • Yard
  • Chain
  • Furlong
  • Mile
  • League
  • Fathom
  • Cable
  • Nautical Mile
  • Link
  • Rod

© Copyright 2020 Michel Gammelgaard. All rights reserved. Provided under the MIT license. Ruler icon by Michel Gammelgaard. © Copyright 2020 Michel Gammelgaard. All rights reserved.