What happens
Take a dimensionless quantity declared in a unit that has a scale but no symbol: for example a fraction stored in hundredths, with magnitude 1/100 and an empty symbol. A trace shows its value as the number in that scale with nothing after it. A reading of 0.5 (50 hundredths) prints as 50. The line gives the reader no way to tell it from a plain 50.
This holds after #12, which makes every dimensioned value in a unit without a symbol read in the coherent unit with that unit's spelling (kg, m^2). The rule is in detail::spells_coherent_unit (include/formula-cpp/trace_render.hpp):
return view(declared.symbolText).empty() && !(dimension == dim::Scalar);
It deliberately leaves dimensionless values alone, so a value stays in its declared unit with no text. For a dimensionless unit of scale 1 that is right, since the bare number is the value. For a scaled one, the number is in a scale the line does not name.
Expected
No number is shown in a scale the line does not name. Either:
- a dimensionless value in a scaled unit with no symbol is shown in the coherent dimensionless unit (scale 1):
1/2 rather than 50; or
- such a unit is refused where it is declared, since a scaled dimensionless unit without a symbol cannot be written truthfully anywhere.
The same rule should then hold wherever a value is written: step lines, worksheet headers, table bounds and snap neighbours all go through shown_unit_of / shown_unit_text.
Test
A dimensionless quantity in a unit with magnitude 1/100 and no symbol, traced. Its line must not read 50 for a value of one half. The test that walks whole traces, in test/trace_shown_unit_tests.cpp, should also accept the chosen spelling.
What happens
Take a dimensionless quantity declared in a unit that has a scale but no symbol: for example a fraction stored in hundredths, with magnitude 1/100 and an empty symbol. A trace shows its value as the number in that scale with nothing after it. A reading of 0.5 (50 hundredths) prints as
50. The line gives the reader no way to tell it from a plain 50.This holds after #12, which makes every dimensioned value in a unit without a symbol read in the coherent unit with that unit's spelling (
kg,m^2). The rule is indetail::spells_coherent_unit(include/formula-cpp/trace_render.hpp):return view(declared.symbolText).empty() && !(dimension == dim::Scalar);It deliberately leaves dimensionless values alone, so a value stays in its declared unit with no text. For a dimensionless unit of scale 1 that is right, since the bare number is the value. For a scaled one, the number is in a scale the line does not name.
Expected
No number is shown in a scale the line does not name. Either:
1/2rather than50; orThe same rule should then hold wherever a value is written: step lines, worksheet headers, table bounds and snap neighbours all go through
shown_unit_of/shown_unit_text.Test
A dimensionless quantity in a unit with magnitude 1/100 and no symbol, traced. Its line must not read
50for a value of one half. The test that walks whole traces, intest/trace_shown_unit_tests.cpp, should also accept the chosen spelling.