Libraryless. Click here for Pure Java version (100L/1K).
1 | static double quantizeToNLevelsBetweenZeroAndOne_stretch(int n, double x) { |
2 | x = clampZeroToOne(x); |
3 | ret doubleRatio(min(n-1, floor(x*n)), n-1); |
4 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032491 |
Snippet name: | quantizeToNLevelsBetweenZeroAndOne_stretch - returns first level as 0 and last level as 1 |
Eternal ID of this version: | #1032491/1 |
Text MD5: | aee8cbd9ae554ecb2477ceae784478ed |
Transpilation MD5: | 436045f45573991972cd0440f20b9a9c |
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:31:48 |
Source code size: | 151 bytes / 4 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 178 / 245 |
Referenced in: | [show references] |