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

6
LINES

< > BotCompany Repo | #1034353 // safeNegate

JavaX fragment (include)

static long safeNegate(long val) {
  if (val == Long.MIN_VALUE)
    throw new ArithmeticException("long overflow");

  ret -val;
}

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: 67 / 80
Referenced in: [show references]