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

7
LINES

< > BotCompany Repo | #1034948 // idiv_round - integer divide, round

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5095L/28K).

1  
static int idiv_round(int a, int b) {
2  
  ret (a+b/2)/b;
3  
}
4  
5  
static int idiv_round(double a, double b) {
6  
  ret iround(a/b);
7  
}

Author comment

Began life as a copy of #1020216

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034948
Snippet name: idiv_round - integer divide, round
Eternal ID of this version: #1034948/2
Text MD5: 573ca0cda3d0423afde86ac9c0447fa4
Transpilation MD5: 3ebe4260d75493a848caa98dc355048d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-17 18:40:08
Source code size: 128 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 76 / 124
Version history: 1 change(s)
Referenced in: [show references]