Skip to content

Trace: an inverse coherent unit after a fraction reads ambiguously (20000/413 1/kg) #17

Description

@christianparpart

What happens

When a value has no unit with a symbol, a trace writes the coherent unit spelled from its base units: detail::coherent_unit_text in include/formula-cpp/trace_render.hpp. With #12 this covers every dimensioned value without a symbol. A dimension with only negative exponents is spelled 1/X, so in the fraction number style a line can read:

#3 / #1 = 20000/413 1/kg

At a glance, that reads as one fraction divided again: 20000/413 per 1/kg, or 20000/(413·1) per kg. The value is right; the spelling invites a misreading. The same happens for 1/s, 1/m^3, 1/(m s) and so on.

Expected

An inverse unit after a number cannot be read as part of the number. Options:

  • negative exponents, kg^-1 (already the caret style the spelling uses for powers);
  • a per form, per kg;
  • keeping 1/kg only where the number is not a fraction.

The spelling is pinned in test/opaque_tests.cpp (coherent_unit_text) and in trace texts across the tests and guides; they change with it.

Note

This is a spelling choice, not a correctness bug. The issue is here to make that choice deliberately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions