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

4
LINES

< > BotCompany Repo | #1005825 // signWithThreshold - like sign, but return 0 if absolute value below threshold

JavaX fragment (include)

static int signWithThreshold(double x, double threshold) {
  if (threshold == 0 ? x == 0.0 : Math.abs(x) < threshold) ret 0;
  ret x < 0 ? -1 : 1;
}

Author comment

Began life as a copy of #1005824

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005825
Snippet name: signWithThreshold - like sign, but return 0 if absolute value below threshold
Eternal ID of this version: #1005825/1
Text MD5: f2e4c48658d7d7baa1c1e56a2143bbd8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-10 17:08:57
Source code size: 151 bytes / 4 lines
Pitched / IR pitched: No / No
Views / Downloads: 476 / 509
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)