Libraryless. Click here for Pure Java version (48L/1K).
1 | static int roundUpTo(int n, int x) { |
2 | return (x+n-1)/n*n; |
3 | } |
4 | |
5 | static long roundUpTo(long n, long x) { |
6 | return (x+n-1)/n*n; |
7 | } |
8 | |
9 | static double roundUpTo(double n, double x) { |
10 | return floor((x+n-1)/n)*n; |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001008 |
Snippet name: | roundUpTo - unintuitive argument order |
Eternal ID of this version: | #1001008/5 |
Text MD5: | b8e3a86691a7d9c95ccd05b805343a55 |
Transpilation MD5: | 25a8586200d01a38cc599650bfb8230b |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-10-10 20:30:46 |
Source code size: | 213 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 740 / 1102 |
Version history: | 4 change(s) |
Referenced in: | [show references] |