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

13
LINES

< > BotCompany Repo | #1022910 // fourPointRangeScore

JavaX fragment (include)

static double fourPointRangeScore(double value, FourPointsRange range) {
  if (range == null) ret 0;
  if (value >= range.min && value <= range.max) ret 1;
  if (value <= range.tooLow || value >= range.tooHigh) ret 0;
  if (value <= range.min)
    ret (value-range.tooLow)/(range.min-range.tooLow);
  else
    ret 1-(value-range.max)/(range.tooHigh-range.max);
}

static double fourPointRangeScore(FourPointsRange range, double value) {
  ret fourPointRangeScore(value, range);
}

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: 307 / 345
Version history: 1 change(s)
Referenced in: [show references]