Am using Math.round and I am finding that it will not return me any value larger then (2^32/2)-1, but the documentation states it can/will return long values, i.e. 2^64... There a code snippet below.
long bTmp = (long)Math.round(4294967296L);
System.out.println(bTmp);
System.out.println(Long.MAX_VALUE);
which output:
2147483647
9223372036854775807
Am I missing something?
It is calling the overload of Math.round()
which takes a float
and returns an int
. See
the javadoc.
Try:
Math.round((double) 4294967296L)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With