Ideal-gas pressure, volume, amount or temperature, and a gas volume at a named reference condition, version 1.0.1
calc-gas-law@1.0.1: this version's equations with their symbols, each constant's value, their sources and whether each was read, a worked example where the record holds one, its level and what it was checked against, the number of cases, and what was not checked. This version's record is not rewritten; a correction is added under Changes.
What this page can and cannot show
Level: Checked against a reference; ideal, dry gas; absolute pressure; the reference condition named or stated. Reference kind: our own exact-arithmetic script and a hand-worked case; a reference program this project wrote itself, second implementation (Python 3.13), 2026-11-14, exact rationals (Python fractions) on the exact value of each input double, each output rounded once to the nearest double; not an outside program.
Checked by this project, not independently reviewed. Every method on this page has its equations, constants, sources and cases on record, and its cases agree with the stated reference within the stated tolerance. A reader can follow each method's worked example by hand; that shows the stated method gives the stated answer for one set of inputs, and does not test the code. The other cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed them.
Every version of this method · Every method · What the levels mean
Version 1.0.1
Level: Checked against a reference; ideal, dry gas; absolute pressure; the reference condition named or stated. Reference kind: our own exact-arithmetic script and a hand-worked case; a reference program this project wrote itself, second implementation (Python 3.13), 2026-11-14, exact rationals (Python fractions) on the exact value of each input double, each output rounded once to the nearest double; not an outside program. calc-gas-law@1.0.1
Built, not hosted. Generated from a snapshot of the library's records taken on 2026-11-25, as committed on 2026-11-25. A later snapshot replaces this one, so these records and this page can change.
Verification statement: pV = nRT with R = N_A k exactly (CODATA 2022); the two printed molar volumes reproduced to every digit (3 cases); every output compared in exact rationals with a second implementation in Python by a separate agent of the same model family (91 cases at 1.0.1, 25 at the edges). Ideal gas only. Research arithmetic.
From three of pressure, volume, amount and temperature, the fourth by pV = nRT with R = N_A·k exact (CODATA 2022); with a reference condition, the molar volume RT/p there and the gas's volume at it.
- How results are reported: Inputs as their shortest decimals, converted exactly and rounded once; bounds decided on that value, ends included unless stated as above or below; checks in this order, the first failure answered: the input schema (an ambient pressure below zero is OUT_OF_RANGE; zero, a vacuum, is read), PRESSURE_ARGUMENTS, GAUGE_WITHOUT_AMBIENT, STATE_COUNT, PRESSURE_NOT_POSITIVE on the absolute pressure, REFERENCE_ARGUMENTS, PRESSURE_NOT_POSITIVE on a stated reference pressure; the named references are IUPAC-0C-100kPa 273.15 K and 100 kPa, 0C-1atm 273.15 K and 101.325 kPa, 20C-1atm 293.15 K and 101.325 kPa, 25C-1atm 298.15 K and 101.325 kPa; the arithmetic is exact on the inputs' decimals and each result rounded once; none: the nearest double to each exact rational. A result whose exact value is not zero but rounds to zero, or that lies beyond the double range, refuses the whole call as RESULT_OUTSIDE_DOUBLE_RANGE.
- Uncertainty: Exact for the ideal-gas law with R exact; how far a real gas departs from it is not estimated.
- Reference, as its record states it: NIST CODATA 2022 molar volumes of an ideal gas reproduced to every printed digit; exact rational arithmetic, against a second implementation in Python by a separate agent of the same model family
- Level confirmed by this project's ruling of 14 November 2026
What this page can and cannot show
What was checked
157 cases in 3 files, linked by this exact version.
Run through the tool at build against our own exact-arithmetic script and a hand-worked case; a reference program this project wrote itself, second implementation (Python 3.13), 2026-11-14, exact rationals (Python fractions) on the exact value of each input double, each output rounded once to the nearest double; not an outside program: 80 agree within the tolerance the file states, 77 refuse as the case expects, 0 differ, 0 were not run.
File 1, 21 cases
- Where the expected values came from: our own exact-arithmetic script and a hand-worked case
- Recorded on: 2026-11-11
- Reference: Python fractions: pV = nRT with R = N_A·k typed from CODATA 2022, CPython 3.13.18; licence PSF-2.0
- Tolerance as the file states it: relative 1e-15 on every number (absolute 1e-21 below 1e-6, in its own unit); statuses, codes and units exact
File 2, 45 cases
- Where the expected values came from: an outside program, second implementation (Python 3.13) 2026-11-14
- Recorded on: 2026-11-14
- Reference: second implementation (Python 3.13), 2026-11-14; licence BSD-3-Clause
- Tolerance as the file states it: every number relative 1e-12 (absolute 1e-15 below 1e-3, in each value's unit); strings, notes, statuses and codes exact
File 3, 91 cases
- Where the expected values came from: our own exact-arithmetic script and a hand-worked case
- Recorded on: 2026-11-14
- Reference: second implementation (Python 3.13), 2026-11-14; licence BSD-3-Clause
- Tolerance as the file states it: every number relative 1e-12 (absolute 1e-15 below 1e-3, in each value's unit); strings, notes, statuses and codes exact
Apart from the worked example, the cases and their values are not printed here. This shows agreement with this project's recorded cases. It does not show that a method suits your work, and it is not a qualification.
What was not checked
Real-gas behaviour and compressibility; humid gas and water vapour; mass-flow controllers' own 'standard' conditions beyond the four named and a stated one; gas mixtures' partial pressures.
Definition or model
A closed form: the result follows from the inputs by the equations alone.
Equations
Equation 1
p·V = n·R·T, solved for whichever of p, V, n and T is not given
| Symbol | Meaning and unit |
|---|---|
| p | absolute pressure (given, or a gauge pressure plus the stated ambient pressure); 1 atm = 101325 Pa and 1 bar = 100 kPa exactly, kPa |
| V | gas volume, L |
| n | amount of gas, mol |
| R | molar gas constant, J/(mol*K) |
| T | thermodynamic temperature, K |
Source: NIST, CODATA Internationally recommended 2022 values of the Fundamental Physical Constants: complete listing (allascii.txt), row molar volume of ideal gas (273.15 K, 100 kPa) and (273.15 K, 101.325 kPa): V_m = RT/p, of which pV = nRT is n times, 2022 CODATA adjustment; read in full on 2026-11-11 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 77fb90e66c40. Free to read (NIST Standard Reference Data, a US government work; reproduction terms not yet reviewed), checked 2026-11-11. No erratum found (searched the listing's own header (2022 CODATA adjustment), physics.nist.gov constants pages), 2026-11-11.
Equation 2
V_m = R·T_ref/p_ref
the volume at the reference V_ref = n·V_m
| Symbol | Meaning and unit |
|---|---|
| V_m | molar volume of an ideal gas at the reference condition, L/mol |
| T_ref | reference temperature, K |
| p_ref | reference pressure, kPa |
| V_ref | the gas's volume at the reference condition, L |
Source: NIST, CODATA Internationally recommended 2022 values of the Fundamental Physical Constants: complete listing (allascii.txt), row molar volume of ideal gas (273.15 K, 100 kPa) and (273.15 K, 101.325 kPa), 2022 CODATA adjustment; read in full on 2026-11-11 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 77fb90e66c40. Free to read (NIST Standard Reference Data, a US government work; reproduction terms not yet reviewed), checked 2026-11-11. No erratum found (searched the listing's own header (2022 CODATA adjustment), physics.nist.gov constants pages), 2026-11-11.
Constants
| Constant | Value and unit | Source | Date read |
|---|---|---|---|
| molar gas constant, R = N_A·k exactly (the listing prints R truncated) (R) | 8.31446261815324 J/(mol·K) | NIST, CODATA Internationally recommended 2022 values of the Fundamental Physical Constants: complete listing (allascii.txt), row Avogadro constant (6.022 140 76 e23 mol^-1, exact) and Boltzmann constant (1.380 649 e-23 J K^-1, exact); molar gas constant | 2026-11-11 |
Worked example
Worked example: one case of calc-gas-law@1.0.1, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.
Inputs
- amount = 0.5 mol
- volume = 10 L
- temperature = 300 K
Steps
- R = 8.3144626 J/(mol·K), by equation 1.
- p = 124.71694 kPa, from amount, temperature, volume, R; by equation 1; gives absolutePressure.
The working, as the case writes it:
R = N_A·k = 6.02214076e23 × 1.380649e-23 = 8.31446261815324 J/(mol·K)
p = nRT/V = 0.5 mol × 8.31446261815324 × 300 K / 0.010 m³ = 124716.94 Pa = 124.71694 kPa.
Answer
absolutePressure= 124.71694 kPa
Where these values came from: our own exact-arithmetic script and a hand-worked case; worked by hand, and in exact rationals.
At build the tool returned this answer within the tolerance the file states: relative 1e-15 on every number (absolute 1e-21 below 1e-6, in its own unit); statuses, codes and units exact.
Who worked this case: not recorded.
What it refuses, and its input ranges
STATE_COUNT(invalid input): not exactly three of pressure, volume, amount and temperature are givenPRESSURE_ARGUMENTS(invalid input): both an absolute and a gauge pressure are given, or an ambient pressure without a gauge pressureGAUGE_WITHOUT_AMBIENT(invalid input): a gauge pressure is given without the ambient pressure, which is never defaultedPRESSURE_NOT_POSITIVE(invalid input): the absolute pressure, given or formed as gauge plus ambient, or a stated reference pressure, is zero or belowREFERENCE_ARGUMENTS(invalid input): a reference condition is both named and stated, or a stated one lacks its temperature or pressure
Flags and notes a reply may carry
A note a reply may carry:
IDEAL_DRY_GAS: Ideal gas only: no compressibility correction is made, and the gas is taken as dry, with no water vapour subtracted.
Changes
2026-11-14-calc-gas-law@1.0.1-1
2026-11-14 · calc-gas-law@1.0.1 · Corrections to our methods
- What was wrong: A stated reference pressure of zero crashed the tool (a division by zero), and one below zero, such as -1 kPa, gave a negative molar volume; a negative ambient pressure was accepted whenever gauge plus ambient was positive; and a result whose exact value is not zero but is smaller than the smallest double was reported as 0 (1e-300 umol at 1e-300 K and 1e300 kPa gave a volume of 0 L).
- Affected: Calls in version 1.0.0 with a stated reference pressure of zero or below, or a negative ambient pressure, in the assistant tool calc_gas_law. Every other call was unaffected.
- What changed: In 1.0.1 a stated reference pressure of zero or below is invalid-input PRESSURE_NOT_POSITIVE, an ambient pressure below zero is invalid-input OUT_OF_RANGE (zero, a vacuum, is read), and a result whose exact value is not zero but rounds to zero is refused whole as RESULT_OUTSIDE_DOUBLE_RANGE, as the kit refuses one beyond the double range. No published case's number moved.
- How it was found: A second implementation in Python by a separate agent of the same model family, in the raising run's full check of 14 November 2026; the CSO's GL1 run.
- Cases added: None yet: the cases at each guard enter with the next fixture from that check.
Tools that use it
Cite this version
Ideal-gas pressure, volume, amount or temperature, and a gas volume at a named reference condition. Drybench; calc-gas-law@1.0.1; https://www.drybench.com/methods/m/calc-gas-law/1.0.1 (accessed [date]).