Skip to content

Issues decoding byte values #90

@andrewwhitehead

Description

@andrewwhitehead

For a test case I'm generating random bytes and decoding them as Decimal32. It seems like this library doesn't handle non-canonical values, and the comment on the coefficient() method is invalid.

With the test input [0x78, f1, 5b, a3] decoded using Decimal32::from_be_bytes, I get a value which shows as 'Infinity' when printed, but has a coefficient of 56723 (not zero) and an exponent of 2013265920 (not valid).

It would also be nice to have dedicated methods to check if a decoded decimal number is NaN or Infinity, maybe is_finite, is_infinite, is_nan, is_normal, is_subnormal as with the native float types.

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