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

15
LINES

< > BotCompany Repo | #1019119 // LearnDoubleRange

JavaX fragment (include)

sclass LearnDoubleRange {
  double min = positiveInfinity(), max = negativeInfinity();
  
  void add(Number n) {
    if (n != null) {
      double d = toDouble(n);
      min = min(min, d);
      max = max(max, d);
    }
  }
  
  bool empty() { ret min > max; }
  
  DoubleRange range() { ret empty() ? null : DoubleRange(min, max); }
}

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: 325 / 846
Version history: 8 change(s)
Referenced in: [show references]