-
Notifications
You must be signed in to change notification settings - Fork 120
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
bytes.as-int
#632
Comments
@andreoss what do you think? |
@yegor256 @IngeniariusSoftware |
@andreoss @IngeniariusSoftware I think |
@andreoss, is this really the expected behavior? I looked at how bytes are converted to numbers in different languages, and there, expressed in our logic, bytes are placed at the end of the array without transferring the first byte to the beginning. If necessary, completing the sign:
@yegor25, what is the advantage of using a strictly 8-byte limit? Isn't this redundant encoding? Pay attention to the 3) 00-00-00-00-00-00-01-00.not.as-int = -144115188075855617
Expected: -257 I specifically take 8 bytes, but the result is still different. Instead of storing all 8 bytes, BigInteger truncates to the required minimum, and as a result our converter gets |
@IngeniariusSoftware the design of EO is "explicit". This means that we don't make any assumptions, which are not visible to a programmer. Instead, we "fail fast" when the input doesn't look exactly as we expect it. It must be the responsibility of a programmer: to prepare the data the way we expect it to look like. That's why I suggest |
@yegor256 Please, assign |
@andreoss go ahead please |
@andreoss what's up with this? |
@yegor256 Will open a PR, sorry for the delay |
`and`, `or`, `xor` do not truncate array.
`and`, `or`, `xor` do not truncate array.
@IngeniariusSoftware the puzzle #1043 is still not solved. |
@IngeniariusSoftware the puzzle #1046 is still not solved; solved: #1043. |
@IngeniariusSoftware the puzzle #1142 is still not solved; solved: #1043, #1046. |
eo/eo-runtime/src/main/java/org/eolang/Param.java
Lines 117 to 131 in f9bf9be
the current implementation of as-bytes gives us incorrect results for bytes:
The text was updated successfully, but these errors were encountered: