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

9
LINES

< > BotCompany Repo | #1027283 // sqrt2progression_int (divide by sqrt(2) repeatedly)

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

Libraryless. Click here for Pure Java version (2218L/14K).

1  
static L<Int> sqrt2progression_int(int n, double startValue) {
2  
  L<Int> l = emptyList(n);
3  
  double x = startValue;
4  
  for i to n: {
5  
    l.add(iround(x));
6  
    x /= sqrt(2);
7  
  }
8  
  ret l;
9  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027283
Snippet name: sqrt2progression_int (divide by sqrt(2) repeatedly)
Eternal ID of this version: #1027283/3
Text MD5: 49a21a5904d9ad0cb3a2dd8017bd064e
Transpilation MD5: bedf2b4fcbe6974ad86e5a3df3439ba3
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-29 16:42:30
Source code size: 193 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 168 / 261
Version history: 2 change(s)
Referenced in: [show references]