... turned out to clip pretty fast and it's only possible to use numbers in the range of signed ints.
2147483648.0 (that is INT32_MAX + 1) and any other number greater than INT32_MAX yield for me a result of 18446744071562067968.
Overflow:
Say MAX is the the maximum of an accepted range and rounduint64(MAX) is called, then 0.5 + MAX will result in an overflow, because 0.5 + MAX is greater than MAX.
Negative numbers:
The results for positive numbers seem to be fine and anything greater or equal than .5 is rounded up:
Range:
... turned out to clip pretty fast and it's only possible to use numbers in the range of signed ints.
2147483648.0
(that isINT32_MAX + 1
) and any other number greater thanINT32_MAX
yield for me a result of18446744071562067968
.Overflow:
Say
MAX
is the the maximum of an accepted range androunduint64(MAX)
is called, then0.5 + MAX
will result in an overflow, because0.5 + MAX
is greater thanMAX
.Negative numbers:
The results for positive numbers seem to be fine and anything greater or equal than
.5
is rounded up:But what about negative numbers?
Is this expected behavior?