summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/bc/bcmul.js.map
blob: 3a574f33014faa6cb5776f1763135f462937517f (plain) (blame)
1
{"version":3,"sources":["../../../src/php/bc/bcmul.js"],"names":["module","exports","bcmul","leftOperand","rightOperand","scale","_bc","require","libbcmath","first","second","result","bc_init_num","php_str2num","toString","bc_multiply","n_scale"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,KAAT,CAAgBC,WAAhB,EAA6BC,YAA7B,EAA2CC,KAA3C,EAAkD;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,MAAMC,QAAQ,iBAAR,CAAV;AACA,MAAIC,YAAYF,KAAhB;;AAEA,MAAIG,KAAJ,EAAWC,MAAX,EAAmBC,MAAnB;;AAEA,MAAI,OAAON,KAAP,KAAiB,WAArB,EAAkC;AAChCA,YAAQG,UAAUH,KAAlB;AACD;AACDA,UAAUA,QAAQ,CAAT,GAAc,CAAd,GAAkBA,KAA3B;;AAEA;AACAI,UAAQD,UAAUI,WAAV,EAAR;AACAF,WAASF,UAAUI,WAAV,EAAT;AACAD,WAASH,UAAUI,WAAV,EAAT;;AAEAH,UAAQD,UAAUK,WAAV,CAAsBV,YAAYW,QAAZ,EAAtB,CAAR;AACAJ,WAASF,UAAUK,WAAV,CAAsBT,aAAaU,QAAb,EAAtB,CAAT;;AAEAH,WAASH,UAAUO,WAAV,CAAsBN,KAAtB,EAA6BC,MAA7B,EAAqCL,KAArC,CAAT;;AAEA,MAAIM,OAAOK,OAAP,GAAiBX,KAArB,EAA4B;AAC1BM,WAAOK,OAAP,GAAiBX,KAAjB;AACD;AACD,SAAOM,OAAOG,QAAP,EAAP;AACD,CApCD","file":"bcmul.js","sourcesContent":["module.exports = function bcmul (leftOperand, rightOperand, scale) {\n  //  discuss at: http://locutus.io/php/bcmul/\n  // original by: lmeyrick (https://sourceforge.net/projects/bcmath-js/)\n  //   example 1: bcmul('1', '2')\n  //   returns 1: '2'\n  //   example 2: bcmul('-3', '5')\n  //   returns 2: '-15'\n  //   example 3: bcmul('1234567890', '9876543210')\n  //   returns 3: '12193263111263526900'\n  //   example 4: bcmul('2.5', '1.5', 2)\n  //   returns 4: '3.75'\n\n  var _bc = require('../_helpers/_bc')\n  var libbcmath = _bc()\n\n  var first, second, result\n\n  if (typeof scale === 'undefined') {\n    scale = libbcmath.scale\n  }\n  scale = ((scale < 0) ? 0 : scale)\n\n  // create objects\n  first = libbcmath.bc_init_num()\n  second = libbcmath.bc_init_num()\n  result = libbcmath.bc_init_num()\n\n  first = libbcmath.php_str2num(leftOperand.toString())\n  second = libbcmath.php_str2num(rightOperand.toString())\n\n  result = libbcmath.bc_multiply(first, second, scale)\n\n  if (result.n_scale > scale) {\n    result.n_scale = scale\n  }\n  return result.toString()\n}\n"]}