Skip to content

posit NaR binary representation with to_binary shows 0b1.0000001.. nar #559

@kartoffelkopp8

Description

@kartoffelkopp8

Description

I am experimenting with posit arithmetic using the Universal library and encountered an unexpected pretty print representation for NaR (Not a Real) values.

My current Programm:

Image Expected Behavior

According to the posit standard (as defined by John L. Gustafson), NaR is represented as a 1 followed by all zeros:

For posit<8,2>: binary 10000000 (hex 0x80)

I would expect the pretty print to reflect this, e.g., 0b1.0000000.. (sign=1, regime=all zeros, rest omitted)

Actual Behavior

The output shows:
text

NaR: 0b1.0000001.. nar

This representation appears to suggest a 1 in the final bit of the regime portion (0000001), which would correspond to hex 0x81 rather than 0x80.

Questions

Is this a bug in the pretty printer, or am I misinterpreting the notation?

Thanks

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