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

4
LINES

< > BotCompany Repo | #1032492 // quantizeToNLevelsBetweenZeroAndOne_midPoint - returns mid point of interval (e.g. .25 or .75)

JavaX fragment (include)

static double quantizeToNLevelsBetweenZeroAndOne_midPoint(int n, double x) {
  x = clampZeroToOne(x);
  ret doubleRatio(min(n-1, floor(x*n))+.5, n);
}

Author comment

Began life as a copy of #1032491

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032492
Snippet name: quantizeToNLevelsBetweenZeroAndOne_midPoint - returns mid point of interval (e.g. .25 or .75)
Eternal ID of this version: #1032492/1
Text MD5: 73bb594c0c064ee5740d7358831f3cca
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-10 17:34:49
Source code size: 153 bytes / 4 lines
Pitched / IR pitched: No / No
Views / Downloads: 78 / 101
Referenced in: [show references]