You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above program, compiled with the latest main branch prints 31 MB and 32 MB.
Expected output
The result should be 31 MB for both calls. This is because 31.45 is less than 31.5. Hence, should be rounded down.
This could be happening because of rounding errors in floating points.
Also, as a side note, the default rounding behaviour of the Bytes function is not documented properly.
The text was updated successfully, but these errors were encountered:
Yeah, that makes sense. It's a floor as it goes up in magnitude, so it wouldn't use a rounding rule like you expect. I'm not sure there's a best way. It's easy to argue for any of floor, ceiling, or the many rounding variations.
Sample program
Current output
The above program, compiled with the latest main branch prints
31 MB
and32 MB
.Expected output
The result should be
31 MB
for both calls. This is because31.45
is less than31.5
. Hence, should be rounded down.This could be happening because of rounding errors in floating points.
Also, as a side note, the default rounding behaviour of the Bytes function is not documented properly.
The text was updated successfully, but these errors were encountered: