ianmackenzie/elm-units-prefixed/2.4.0

NOTE: the latest version is 2.8.0

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
KilogramsPerCubicMeter

Metric

kilogramsPerCubicMeter : Float -> Density

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

inKilogramsPerCubicMeter : Density -> Float

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

gramsPerCubicCentimeter : Float -> Density

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

inGramsPerCubicCentimeter : Density -> Float

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

Imperial

poundsPerCubicInch : Float -> Density

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

inPoundsPerCubicInch : Density -> Float

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

poundsPerCubicFoot : Float -> Density

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

inPoundsPerCubicFoot : Density -> Float

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