Skip to content

UInteger range inconsistencies #12

@unserializable

Description

@unserializable

Unsigned integer range handling has incorrectnesses / inconsistencies.

E.g. UInteger can be formed from integer -34 but not from long -34.

@Test
public void test_negative_uint_34il() {
    UInteger a = uint(-34);
    UInteger b = uint(-34L);
    assertTrue (a == b);
}

Reported error is Exception in thread "main" java.lang.NumberFormatException: Value is out of range : -34 for the b definition.

I would either expect both of the samples below to fail or succeed, but not act differently. What is the intent in this library? Shouldn't both these cases succeed, since -34 is a value that is representable in 32 bit signed integer?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions