Libraryless. Click here for Pure Java version (2140L/14K).
1 | static float[] normalizeFloats(float[] l) { |
2 | ret normalizeFloats(l, 1f); |
3 | } |
4 | |
5 | static float[] normalizeFloats(float[] l, float targetMax) { |
6 | double factor = doubleRatio(targetMax, floatMax(l)); |
7 | if (factor == 1) ret l; |
8 | int n = l(l); |
9 | float[] x = new float[n]; |
10 | for i to n: |
11 | x[i] = (float) (l[i]*factor); |
12 | ret x; |
13 | } |
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: | 255 / 344 |
Version history: | 2 change(s) |
Referenced in: | [show references] |