Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

6
LINES

< > BotCompany Repo | #1034353 // safeNegate

JavaX fragment (include)

1  
static long safeNegate(long val) {
2  
  if (val == Long.MIN_VALUE)
3  
    throw new ArithmeticException("long overflow");
4  
5  
  ret -val;
6  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034353
Snippet name: safeNegate
Eternal ID of this version: #1034353/1
Text MD5: 49e5bd2f7ec322f767cb6adbefc5f6ed
Author: stefan
Category: javax / math
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-03 05:33:28
Source code size: 135 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 71 / 84
Referenced in: [show references]