Skip to content

Bots numeric precision limits #393

@mrkazoodle

Description

@mrkazoodle

bots/bots/inmessage.py

Lines 185 to 186 in 3277cc1

valuedecimal = float(value)
value = '%.*F'%(lendecimal,valuedecimal)

Bots has numeric precision limits because of for example the code above. To validate fixed numeric input, the value is cast from a string to a float: in case of an error it is logged and processing stops, otherwise the value is formatted back as a string with the original amount of digits.

Impact:

  • Large integers, like SSCC identifiers (18 digits), lose precision
  • Very precise decimals lose precision
  • Hard to find problem: no error because of precision loss

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions