Repository navigation
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description of the bug
Discovered by Claude while auditing the physical quantities features:
Physical quantity mode: errors found in code review
Unit table (app/utility/unit_system_conversions.py)
- Roentgen expands to kelvin/kilogram; should be coulomb/kilogram. Docs table has the same error.
- Angle conventions are mixed. Degree = 1/360 and radian = 1/(2*pi) (one turn = 1), but angleminute = pi/10800 and anglesecond = pi/648000 assume radian = 1. Result: 60 angleminute != 1 degree.
-
radmaps to the absorbed-dose unit (0.01 Gy); radian usesr. Input3.14 radparses as a dose with dimension m^2/s^2. - Litre plurals are one string,
('litres,liters',); neither plural is recognised. Should be('litres', 'liters'). - Comment says short forms of set_of_common_units_in_SI are unused, but SLR_generate_unit_dictionaries loads x[1] for all units. Consequences:
daalso maps to deci-are; with units_string without imperial,ftparses as femto-metricton. - Truncated constants: pint 0.00056826 (exact 0.00056826125), electronvolt 1.60218e-19 (exact 1.602176634e-19), atomic mass unit 1.66054e-27 (1.66053906660e-27).
- Bel comment says "log(10) in base 2"; the value is the natural log of 10.
- Docs only: gallon listed as 4546.09 litre (should be 4.54609), barn in metre (should be metre^2), kelvin symbol shown as
k, litre symbol shown asl(code usesL).
Transforms (app/utility/physical_quantity_utilities.py)
- transform_prefixes_to_standard: the
(?<!\w)lookbehind fails after a digit.5 μmconverts,5μmdoes not, and μ is not in the unit dictionaries.
Comparison (app/context/physical_quantity.py)
- is_proportional: the
elifrepeats the test on expr0; the expr1 branch never runs. -
<,>,<=,>=criteria: with mismatched dimensions, bool() on an undecided SymPy relational raises TypeError. No tolerance is applied to these comparisons. - feedback_string_generator is a stub returning None.
- Docs say criteria are ignored when physical_quantity is true; the code supports matches, dimension and comparison criteria.
Parser (app/utility/slr_parsing_utilities.py)
- ExprNode uses a mutable default
tags=set(), shared by all nodes created without a tag_handler. copy() also passes the same set object to the copy. - SLR_Parser.parse:
output += ExprNode(self.parse(tokens), [])passes a list where a Token is expected; this path would raise. - parse_quantity rebuilds the SLR parser table on every evaluation. Cache by (units_string, strictness).
Expression(s)/input that trigger it
.Expected vs. actual result
.
Steps to reproduce / where it was used
.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
peterbjohnson commentedon Oct 28, 2026
Also, (additional items from #303, which was otherwise a duplicate):
steradianis(1/(4*pi))in this file.lumenis set to(candela), andluxto(metre**(-2)*candela). Both are missing the steradian factor.nauticalmilesshould benautical_milesto matchnautical_mile.1.66053906892e-27.m-messer commentedon Oct 30, 2026
Status of each item (including those from #303) against packages
0.4.0-rc1-previewand the fix stack (top: #302).Resolved
data.py:second*ampere/kilogrampi/180; 60 angleminute = 1 degreeradvs radiandata.py(ris the radian)("litres", "liters")ftas femto-metricton1 ft=0.3048 mnauticalmilesnautical_milesis the plural; the old spelling is kept as an aliasis_proportionalelif</>TypeError with mismatched dimensionscomparison_functionreturnsNone)tags/ shared copy,SLR_Parser.parselist argument, parser rebuilt per evaluationslr_parsingrewrite;build_quantity_parseris cachedStill open, tracked separately
da(deci-are) reading → Unit table: inexact eV and u constants, thedareading, and a missing stone plural lambda-feedback-packages#235μm) → Micro prefix not recognised without a space:5μm,5µm,5mum,5μ mlambda-feedback-packages#24</>comparisons → A singleToleranceabstraction for rtol/atol #308k, roentgen, radian/steradian, "criteria ignored") →user.mdphysical-quantity reference is out of date with the unit table #314Open until #284 and #286 reach
main.🤖 Generated with Claude Code