1 | // TODO: optimize to x-(x%n) in case that's the same thing |
2 | // (or x-mod(x,n)?) |
3 | static int roundDownTo(int n, int x) { |
4 | return x/n*n; |
5 | } |
6 | |
7 | static long roundDownTo(long n, long x) { |
8 | return x/n*n; |
9 | } |
10 | |
11 | static double roundDownTo(double n, double x) { |
12 | return floor(x/n)*n; |
13 | } |
Began life as a copy of #1001008
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1013672 |
Snippet name: | roundDownTo - unintuitive argument order |
Eternal ID of this version: | #1013672/5 |
Text MD5: | 221efe77d9e0ce004b716c8436901579 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-12-07 21:46:34 |
Source code size: | 282 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 490 / 1305 |
Version history: | 4 change(s) |
Referenced in: | [show references] |