Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 5 Nov 2026. What's built · Install 0.3.0
jadpo
ReferencePhysical quantities

LanguageValues and typesStandard typesPhysical quantities

Temperature

On this page

A temperature: 21degC, 70degF or 300kelvin.

Use it for a reading on a thermometer. For a gap between two readings, use TemperatureDifference.

Shape

One value, with no fields to fill in. As text it reads 373.15 kelvin.

Example

example
Temperature(21degC)

text.parse(raw, as: Temperature) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 5, 1.2.3 or five.

These operations give one: units.of and units.sum.

Good to know

  • You can add a TemperatureDifference to one, and subtracting one from another gives a TemperatureDifference. Two temperatures can't be added.
  • It is held in kelvin to 3 places.
  • == tells you whether two are the same, and < and list.sort_by compare and sort them.

In JSON

An object of its parts, in a request, a response or json.write:

json
{"value":"0","unit":"kelvin"}{"value":"273.15","unit":"kelvin"}{"value":"373.15","unit":"kelvin"}

Details

Text form, storage, how it is shown, and operations

Temperature is in the group Physical quantities, and has been in Jadpo since 0.1.0.

Text form

text.from writes one standard text form, the same form text.parse reads back: 0 kelvin, 273.15 kelvin and 373.15 kelvin.

How it is stored

It is stored in one column named for the field, of type numeric(38, 3), holding the temperature in kelvins (K). 273.15 kelvin is stored as 273.15.

How it is shown to people

text.format(value, locale:) shows it to people in their locale. A call may also give unit:.

With locale: Locale.en_gb:

Value Shown
0 kelvin 0 K
273.15 kelvin 273.15 K
373.15 kelvin 373.15 K

Operations

  • units.in(value: Quantity, unit: QuantityUnit, scale: Int, rounding: Rounding) -> Decimal: value in unit, a unit of its kind, as a Decimal of scale places rounded by rounding: units.in(5km, LengthUnit.mile, scale: 2, rounding: Rounding.half_even) is 3.11.
  • units.of(value: Number, unit: QuantityUnit) -> Quantity: value of unit, an Int or a Decimal, as the quantity of unit's kind, converted exactly to the base unit and rounded half to even to the kind's scale: units.of(5, LengthUnit.mile).
  • units.sum(items: List<Quantity>) -> Quantity: The items added up, all of one kind; nothing for no items. A Temperature or a SoundLevel doesn't add to itself, so neither is summed.

It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.

Markdown for agents: /docs/types/type-temperature.md.Built from Jadpo main at aee2e8f.