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

5
LINES

< > BotCompany Repo | #1029772 // iroundHalfDown - round down when exactly .5

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

Libraryless. Click here for Pure Java version (30L/1K).

static int iroundHalfDown(double d) {
  double i = Math.floor(d); // integer portion
  double f = d - i; // fractional portion
  ret (int) (f <= 0.5 ? i : i + 1);
}

Author comment

Began life as a copy of #1003741

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1029772
Snippet name: iroundHalfDown - round down when exactly .5
Eternal ID of this version: #1029772/4
Text MD5: 0bef6440c610c024ad7640449478a7d2
Transpilation MD5: 9fd8cbf461b3bc8a13f4d07e9292101a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-12 03:16:17
Source code size: 168 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 115 / 162
Version history: 3 change(s)
Referenced in: [show references]