Skip to content

Quantity

Represents a physical quantity with a unit.

$ wo 'Quantity[2, 3]'
6

Singular unit names are canonicalized to their plural form.

$ wo 'Quantity[1, "Mole"]'
Quantity[1, Moles]

When quantities are multiplied, the compound unit's factors are ordered alphabetically.

$ wo 'Quantity[100, "Watts"] * Quantity[2, "Hours"]'
Quantity[200, Hours*Watts]

Functions like Abs and Floor apply to the magnitude and keep the unit.

$ wo 'Abs[Quantity[-5, "Meters"]]'
Quantity[5, Meters]

Max and Min compare quantities after converting to a common unit, returning the winner in its original unit.

$ wo 'Max[Quantity[1, "Meters"], Quantity[50, "Centimeters"]]'
Quantity[1, Meters]

Sign predicates test the magnitude.

$ wo 'Positive[Quantity[5, "Meters"]]'
True

Mod of two compatible quantities returns the result in the divisor's unit.

$ wo 'Mod[Quantity[7, "Meters"], Quantity[300, "Centimeters"]]'
Quantity[100, Centimeters]