Libraryless. Click here for Pure Java version (2140L/14K).
static float[] normalizeFloats(float[] l) { ret normalizeFloats(l, 1f); } static float[] normalizeFloats(float[] l, float targetMax) { double factor = doubleRatio(targetMax, floatMax(l)); if (factor == 1) ret l; int n = l(l); float[] x = new float[n]; for i to n: x[i] = (float) (l[i]*factor); ret x; }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025060 |
Snippet name: | normalizeFloats |
Eternal ID of this version: | #1025060/3 |
Text MD5: | fbddba0f69a7992eb92f0895537fa1c6 |
Transpilation MD5: | 3edf5f17aace88b8f13beeb40ac69c63 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-03 22:05:06 |
Source code size: | 333 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 254 / 342 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1033034 - normalizeDoubles |