|  | Order is chaos that we understand. | |
| Utilities | ||
#!/usr/bin/env node /** * @name nominal.js * @author XGuest <xguest@list.ru> * @link https://github.com/xguest/nominal * @version 2.0.1.0 * @copyright GPL applies. * No warranties XGuest[05.02.2016/09:48:26] nominal[ver.2.0.1.0] * #guid {A645E9CA-BE33-4642-AF0F-B4EF046D31E7} * * @description       *        *  -28884-90,  63 63 * * @param {Number} [a]   -  , *   -  a >= (-1 * b) * undefined -     b * * @param {Number} [b]     * E3, E6, E12, E24, E48, E96, E192. * undefined -     a * * @return {Number|Object}  (a || b) = undefined - Object  *       */ /*eslint complexity: [2, 13]*/ function nominal(a, b) { function lg(a, b) { //    10 return parseInt(Math.log(a) / Math.LN10 * (b || 1), 10); //   } function pg(a, c) { //    10 var d = 25 > b ? 1 : 2; //   /*eslint no-unused-expressions: [2, { allowShortCircuit: true, allowTernary: true }]*/ 0 > a && (d -= a); //   return Number((Math.pow(10, a) * (c || 1)) // c =  .toFixed(0 < d ? d : undefined)); //  } /*eslint no-caller: 0*/ var c, d = {}; // c = tmp_var; d = out_var; if (!b) { //     for (b = 0; 7 > b; b++) { //    c = 3 * Math.pow(2, b); //    d[c] = arguments.callee(a, c); //  } return d; //   } if (!a) { //    for (a = 1; a < b + 1; a++) { //     d[a] = arguments.callee(-1 * a, b); //  } return d; //   } a = 0 > a ? // a < 0   (c = 25 > b ? 0 : 2, -1 * a - 1) : // (c = lg(a), d = lg(a / pg(c), b), d < 0 ? b + d : d); //   for (d = 0; 7 > d; d++) { //   if (b === (3 * Math.pow(2, d))) {d = 8;break;} //    } if (d !== 8 || Math.abs(a) > b) return; //    a = pg(a / b); //    return pg(c, //  {'2.6': 2.7, '2.9': 3, '3.2': 3.3, '3.5': 3.6, '3.8': 3.9, //  '4.2': 4.3, '4.6': 4.7, '8.3': 8.2, '9.19': 9.2}[a] || a); } module.exports = nominal;  function log(a, b) {return Math.log(b) / Math.log(a);}; Source: https://habr.com/ru/post/277221/
All Articles