ianmackenzie / elm-units-prefixed / Units.Density

A Density value represents a density in grams per cubic centimeter, pounds per cubic inch, etc. It is stored as a number of kilograms per cubic meter.

Note that since KilogramsPerCubicMeter is defined as Rate Kilograms CubicMeters (mass per unit volume), you can construct a Density value using Quantity.per:

density =
    mass |> Quantity.per volume

You can also do rate-related calculations with Density values to compute Mass or Volume:

mass =
    volume |> Quantity.at density

volume =
    mass |> Quantity.at_ density


type alias Density =
Density


type alias KilogramsPerCubicMeter =
Density.KilogramsPerCubicMeter

Metric

kilogramsPerCubicMeter : Basics.Float -> Density

Construct a density from a number of kilograms per cubic meter.

inKilogramsPerCubicMeter : Density -> Basics.Float

Convert a density to a number of kilograms per cubic meter.

gramsPerCubicCentimeter : Basics.Float -> Density

Construct a density from a number of grams per cubic centimeter.

inGramsPerCubicCentimeter : Density -> Basics.Float

Convert a density to a number of grams per cubic centimeter.

Imperial

poundsPerCubicInch : Basics.Float -> Density

Construct a density from a number of pounds per cubic inch.

inPoundsPerCubicInch : Density -> Basics.Float

Convert a density to a number of pounds per cubic inch.

poundsPerCubicFoot : Basics.Float -> Density

Construct a density from a number of pounds per cubic foot.

inPoundsPerCubicFoot : Density -> Basics.Float

Convert a density to a number of pounds per cubic foot.