Skip to content

Trace: a snap's "on a permitted value" test compares raw pairs, while table rows compare values #18

Description

@christianparpart

What is inconsistent

To decide whether a value sits on a row or between two, a trace compares two bounds written as numerator/denominator pairs. With #12, a lookup's segment and a missed lookup's covered range compare them by value, through detail::same_declared_bound in include/formula-cpp/trace_render.hpp, so 2/4 and 1/2 are one row. A snap's "on a permitted value" test does not. snap_suffix (around trace_render.hpp:2164) compares the raw pairs:

if (neighbours.low == neighbours.high)

So two neighbours equal in value but stored as different pairs read as two neighbours, not "on a permitted value".

Expected

Do one of these:

  • If a snap's permitted values can hold the same value as two different pairs, compare by value, as table rows do, using same_declared_bound.
  • If they cannot (if the permitted set is validated as strictly ascending by value where it is declared), say so in a comment at that comparison, so the difference from the table rows reads as intended.

Also

lookup_miss_text spells lowText before it branches, and the two-row path never uses it. Spell it only where it is used.

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