Skip to content

grisharav/QuantityTypes

 
 

Repository files navigation

Build status Gitter NuGet Issues

License:       The MIT License (MIT)
Project page:  https://github.com/objorke/QuantityTypes

NASA's Mars Climate Observer crashed in September 1999 because of a serious breakdown in project management. However, that accident will be best remembered for the simple error that started everything: the value of a thrust parameter was entered into computer systems in imperial, rather than SI units. That such a trivial mistake could ultimately bring about a mission failure is astonishing. It begs the question of why computers cannot help more when working with physical quantities? [Ref. 1]

Features

Examples

Length s = 100 * Length.Metre;
Time t = 9.58 * Time.Second;
Velocity v = s / t;
Console.WriteLine(v); 
Console.WriteLine(v.ToString("0.00[km/h]")); 
Console.WriteLine("Speed: {0:0.00[!km/h] kmph}", v);
Mass m = Mass.Parse("92 kg");
double massInPounds = m.ConvertTo(Mass.Pound);
Temperature temp = 100 * Temperature.DegreeCelsius;
double tempInFahrenheit = temp.ConvertTo(Temperature.DegreeFahrenheit);

References

  1. B. D. Hall. Software support for physical quantities. 2002.
  2. Barton and Nackman. Dimensional analysis. C++ Report
  3. Brown. Introduction to the SI Library of Unit-Based Computation
  4. Brown. Applied Template Metaprogramming in SIUNITS

Links

Other similar libraries

.NET

Java

Python

About

Strongly typed physical quantities.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%