# nholthaus/units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.

Repository: https://github.com/nholthaus/units
Canonical: https://ross.abutalabs.com/products/units
Homepage: http://nholthaus.github.io/units/
Language: C++
License: MIT
License Family: permissive
Topics: unit-conversion, dimensional-analysis, cpp14, template-metaprogramming, compile-time, header-only, no-dependencies
Last push: 2026-08-31T18:02:16+00:00

## Health v2 (maintenance only)
Score: 99/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 100, release rhythm 98, longevity 100
- inputs: {"age_days": 3869, "days_push": 2, "days_rel": 16, "gap_med": 0, "n_releases_24m": 14}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1055, forks 140 (observed 2026-09-01T02:14:05.296705+00:00)

## What it is
A compile-time, header-only C++23 dimensional-analysis and unit-conversion library with no dependencies. It represents physical quantities as types, so unit conversions are implicit and resolved at compile time while dimensionally inconsistent expressions fail to compile.

## Use cases
- convert between units like meters and feet at compile time
- prevent dimensionally inconsistent calculations in physics code
- write quantities with unit literals like 5.0_m
- do dimensional analysis in C++ scientific or engineering code
- avoid unit-mixing bugs in embedded or robotics software
- compute derived quantities like speed from distance and time with type safety

## When to choose
- you write C++ and want type-safe physical quantities with zero runtime conversion overhead
- you need a dependency-free, header-only unit library
- you want unit literals and arithmetic that read like handwritten equations
- you need a wide catalog of units and physical constants

## When to avoid
- you need runtime-configurable or user-defined unit systems parsed at runtime
- you work in a language other than C++ or must support pre-C++23 compilers
- you only need simple one-off conversions where a type system is overkill

## Facets
- artifact type: library
- maturity: active
- function: serialization, math, developer-tools
- domain: developer-tools, simulation, cross-platform
- platform: cpp, cross-platform, windows
- tags: units-of-measure, dimensional-analysis, unit-conversion, header-only, template-metaprogramming, compile-time, cpp23, physical-quantities, no-dependencies, algorithms, linux, macos

## Member repositories
- nholthaus/units (main) score 99

## Provenance
- Observed fields: from GitHub, fetched 2026-09-01T02:14:05.296705+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:58:39.760729+00:00, confidence not recorded.
  - readme: https://github.com/nholthaus/units (fetched 2026-09-01T02:14:05.296705+00:00, sha 5112071d7afe)
  - homepage: http://nholthaus.github.io/units/ (fetched 2026-08-29T13:00:09.272279+00:00, sha f080bcf51fa5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
