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

15
LINES

< > BotCompany Repo | #1019119 // LearnDoubleRange

JavaX fragment (include)

1  
sclass LearnDoubleRange {
2  
  double min = positiveInfinity(), max = negativeInfinity();
3  
  
4  
  void add(Number n) {
5  
    if (n != null) {
6  
      double d = toDouble(n);
7  
      min = min(min, d);
8  
      max = max(max, d);
9  
    }
10  
  }
11  
  
12  
  bool empty() { ret min > max; }
13  
  
14  
  DoubleRange range() { ret empty() ? null : DoubleRange(min, max); }
15  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019119
Snippet name: LearnDoubleRange
Eternal ID of this version: #1019119/9
Text MD5: 9189d68b54dc5805a095ebb93188ad4b
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-24 12:03:06
Source code size: 349 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 438 / 964
Version history: 8 change(s)
Referenced in: [show references]