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

17
LINES

< > BotCompany Repo | #1032657 // doubleMultiRatio

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3809L/22K).

static double doubleMultiRatio(Iterable<Double> l) {
  var it = iterator(l);
  if (!it.hasNext()) ret 0;
  double x = it.next();
  while (it.hasNext())
    x = doubleRatio(x, it.next());
  ret x;
}

static double doubleMultiRatio(double... l) {
  int n = l(l);
  if (n == 0) ret 0;
  double x = l[0];
  for (int i = 1; i < n; i++)
    x -= doubleRatio(x, l[i]);
  ret x;
}

Author comment

Began life as a copy of #1032656

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032657
Snippet name: doubleMultiRatio
Eternal ID of this version: #1032657/1
Text MD5: 5e76b7f626c0e8ad52c73b0e24b4447d
Transpilation MD5: f72b09320c25e65a8b5fc5113679af8c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-30 05:16:44
Source code size: 388 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 84 / 125
Referenced in: [show references]