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).

!7

p-exp {
  int correct = 0;
  //for (int b : ll(-3, 3))
  int b = 3; // always positive
    for (int a = -7; a <= 7; a++) {
      //int x = a < 0 ? b - (-a) % b : a % b;
      int x = a < 0 ? b-1 - (-a-1) % b : a % b;
      int y = mod(a, b);
      if (x != y)
        printStructs(+a, +b, +x, +y);
      else ++correct;
    }
  print("Correct: " + correct);
}

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: 374 / 922
Version history: 5 change(s)
Referenced in: [show references]