REPOSITORY CODING · MEDIUM
Convert absolute temperatures with affine offsets
Temperature conversion applies scale alone and ignores origin offsets. Convert absolute values through the canonical Kelvin origin, but leave temperature differences offset-free.
Repository ImplementationExact dimensional quantity laboratory
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
PHP · 55 minute session
- Convert exact rational quantities between bounded unit expressions. Values are [integer numerator,integer denominator], reduced to a positive denominator without floating-point rounding. Canonical intermediate numerators and denominators are bounded to 10^9; multiplication cross-cancels before evaluating products.
- Dimensions are ordered [length,mass,time,temperature]. Expressions support case-sensitive built-in symbols, the dimensionless unit 1, multiplication, left-associative division and integer powers from -4 to 4. Built-ins include m, cm, km, kg, g, s, min, h, K, degC, degF, N and Pa.
- Absolute temperature conversion includes affine source and target offsets. Delta conversion ignores offsets. Affine units cannot participate in products, divisions or powers other than one. All conversions require identical dimension vectors.
- Custom definitions are bounded unit aliases, may reference other aliases, cannot replace built-ins, and are all validated even when not selected for conversion. Detect alias cycles explicitly, cap alias depth and expression size, and reject unconsumed expression text.
- These are offline mathematical conversions, not a measurement database or a calibration certificate. No code from a unit expression is executed, and the PHP and Symfony environments use the same explicit rational and dimensional modules.
Symfony · 55 minute session
- Convert exact rational quantities between bounded unit expressions. Values are [integer numerator,integer denominator], reduced to a positive denominator without floating-point rounding. Canonical intermediate numerators and denominators are bounded to 10^9; multiplication cross-cancels before evaluating products.
- Dimensions are ordered [length,mass,time,temperature]. Expressions support case-sensitive built-in symbols, the dimensionless unit 1, multiplication, left-associative division and integer powers from -4 to 4. Built-ins include m, cm, km, kg, g, s, min, h, K, degC, degF, N and Pa.
- Absolute temperature conversion includes affine source and target offsets. Delta conversion ignores offsets. Affine units cannot participate in products, divisions or powers other than one. All conversions require identical dimension vectors.
- Custom definitions are bounded unit aliases, may reference other aliases, cannot replace built-ins, and are all validated even when not selected for conversion. Detect alias cycles explicitly, cap alias depth and expression size, and reject unconsumed expression text.