SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Double value = new Long(Long.MAX_VALUE).doubleValue();
  2. value += Double.MIN_VALUE;
  3. if (value < -(new Long(Long.MAX_VALUE).doubleValue()) || value > new Long(Long.MAX_VALUE).doubleValue()) {
  4.   // Expecting code here to execute, but it doesn't.
  5. }
  6.    
  7. 9.223372036854776E18
  8. = 9223372036854776000
  9.    
  10. 9223372036854775807
  11.    
  12. 9223372036854776000 (value)
  13. 9223372036854775807 (Long.MAX_VALUE)
  14.    
  15. double d = Long.MAX_VALUE;
  16. BigDecimal bd= new BigDecimal(d);
  17. System.out.println(bd);
  18.    
  19. double d = Long.MAX_VALUE;
  20. // get the next represented value.
  21. double d1 = Double.longBitsToDouble(Double.doubleToLongBits(d)+1);
  22. System.out.println(d > Long.MAX_VALUE);
  23. System.out.println(d1 > Long.MAX_VALUE);
  24.    
  25. false
  26. true
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top