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

13
LINES

< > BotCompany Repo | #1022910 // fourPointRangeScore

JavaX fragment (include)

1  
static double fourPointRangeScore(double value, FourPointsRange range) {
2  
  if (range == null) ret 0;
3  
  if (value >= range.min && value <= range.max) ret 1;
4  
  if (value <= range.tooLow || value >= range.tooHigh) ret 0;
5  
  if (value <= range.min)
6  
    ret (value-range.tooLow)/(range.min-range.tooLow);
7  
  else
8  
    ret 1-(value-range.max)/(range.tooHigh-range.max);
9  
}
10  
11  
static double fourPointRangeScore(FourPointsRange range, double value) {
12  
  ret fourPointRangeScore(value, range);
13  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022910
Snippet name: fourPointRangeScore
Eternal ID of this version: #1022910/2
Text MD5: 456cfafbf5d02e9a8fb25ac6102ee1c7
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-14 21:14:56
Source code size: 487 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 309 / 348
Version history: 1 change(s)
Referenced in: [show references]