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

20
LINES

< > BotCompany Repo | #1031939 // absDoubleMax

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

Libraryless. Click here for Pure Java version (119L/1K).

1  
static double absDoubleMax(Iterable<Double> l) {
2  
  double max = -Double.MAX_VALUE;
3  
  fOr (double d : l)
4  
    max = Math.max(max, abs(d));
5  
  ret max;
6  
}
7  
8  
static double absDoubleMax(double[] l) {
9  
  double max = -Double.MAX_VALUE;
10  
  fOr (double d : l)
11  
    max = Math.max(max, abs(d));
12  
  ret max;
13  
}
14  
15  
static double absDoubleMax(double[] l, int from, int to) {
16  
  double max = -Double.MAX_VALUE;
17  
  for (int i = from; i < to; i++)
18  
    max = Math.max(max, abs(l[i]));
19  
  ret max;
20  
}

Author comment

Began life as a copy of #1025079

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031939
Snippet name: absDoubleMax
Eternal ID of this version: #1031939/1
Text MD5: 2665bcbee39a2511eebb20e3a911917c
Transpilation MD5: b092c49b5752e6b85d940f3f7c18e3f5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-03 17:11:45
Source code size: 488 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 168 / 238
Referenced in: [show references]