-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UInteger range inconsistencies #12
Comments
Thanks for reporting. Yes, that does look weird because you see two times the value
|
... in other words, the behaviour is expected and consistent across all types, i.e. you'll find the same duality in |
Thanks for the quick reply, @lukaseder! My project javadocs from attached sources don't contain the references you quote. Is the jOOU version which documentation you are referring to available from Maven repositories? But as you said the following:
the String longBitString = Long.toBinaryString(-34L);
String intBitString = Integer.toBinaryString(-34);
System.out.printf("%64s%n", longBitString);
System.out.printf("%64s%n", intBitString); which shows that the last 32 bits of
One can of course do the |
The Javadoc is available here: https://www.jooq.org/products/jOOU/javadoc/latest ... And it should also be available from Maven Central. |
Interesting comment, you're right of course. That could be a design goal. Currently, the most significant 32 bits are required to be all zero, but we don't have to require this in principle. It would lead to the obvious discussion about "clever convenience" vs. "failing early". And it would probably also complicate the But I'm willing to review this change request. |
Unsigned integer range handling has incorrectnesses / inconsistencies.
E.g. UInteger can be formed from integer
-34
but not from long-34
.Reported error is
Exception in thread "main" java.lang.NumberFormatException: Value is out of range : -34
for theb
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?
The text was updated successfully, but these errors were encountered: