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

16
LINES

< > BotCompany Repo | #1017977 // Test mod formulas

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (6491L/46K).

1  
!7
2  
3  
p-exp {
4  
  int correct = 0;
5  
  //for (int b : ll(-3, 3))
6  
  int b = 3; // always positive
7  
    for (int a = -7; a <= 7; a++) {
8  
      //int x = a < 0 ? b - (-a) % b : a % b;
9  
      int x = a < 0 ? b-1 - (-a-1) % b : a % b;
10  
      int y = mod(a, b);
11  
      if (x != y)
12  
        printStructs(+a, +b, +x, +y);
13  
      else ++correct;
14  
    }
15  
  print("Correct: " + correct);
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017977
Snippet name: Test mod formulas
Eternal ID of this version: #1017977/6
Text MD5: b3508e1c27087b77d77a253e2035ee99
Transpilation MD5: 484c17bad64c7782ffd87289f375c9d4
Author: stefan
Category: javax / maths
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-24 13:14:26
Source code size: 378 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 251 / 665
Version history: 5 change(s)
Referenced in: [show references]