Skip to content

packLossy reverts at the exponent ceiling for values it could represent by lifting the coefficient #285

Description

@thedavidmeister

packLossy at the exponent floor divides the coefficient by ten until the exponent reaches int32.min (#284). At the ceiling it reverts ExponentOverflow without attempting the inverse.

1 at int32.max + 1 is the same number as 10 at int32.max, whose exponent is in range. The floor case sheds to fit; the ceiling case refuses.

The two directions are not equally available: dividing always works, losing low digits or shedding zeros for free. Multiplying to lower the exponent grows the coefficient, so it only works while there is int224 headroom — 1 lifts, int224.max at the ceiling cannot lift at all. A fix would lift when the headroom allows and revert otherwise.

Not a path disagreement: the packed and unpacked paths both revert here, so this is not a #271-style inconsistency. It is the asymmetry #284 leaves behind, recorded so the ends can be made to match deliberately rather than by accident.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions