123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0});
- const a = [
- "",
- "K",
- "M",
- "B",
- "T",
- "aa",
- "ab",
- "ac",
- "ad",
- "ae",
- "af",
- "ag",
- "ah",
- "ai",
- "aj",
- "ak",
- "al",
- "am",
- "an",
- "ao",
- "ap",
- "aq",
- "ar",
- "as",
- "at",
- "au",
- "av",
- "aw",
- "ax",
- "ay",
- "az",
- "ba",
- "bb",
- "bc",
- "bd",
- "be",
- "bf",
- "bg",
- "bh",
- "bi",
- "bj",
- "bk",
- "bl",
- "bm",
- "bn",
- "bo",
- "bp",
- "bq",
- "br",
- "bs",
- "bt",
- "bu",
- "bv",
- "bw",
- "bx",
- "by",
- "bz",
- "ca",
- "cb",
- "cc",
- "cd",
- "ce",
- "cf",
- "cg",
- "ch",
- "ci",
- "cj",
- "ck",
- "cl",
- "cm",
- "cn",
- "co",
- "cp",
- "cq",
- "cr",
- "cs",
- "ct",
- "cu",
- "cv",
- "cw",
- "cx",
- "cy",
- "cz"
- ];
- class s {
- constructor() {
- (this.value = 0), (this._numberStr = "");
- }
- init(t, e) {
- return t instanceof s ? this.initByBigNum(t) : this.initByNumber(t, e);
- }
- initByNumber(t, e) {
- return (this._numberStr = ""), (this.value = t * Math.pow(10, e)), this;
- }
- initByBigNum(t) {
- return (this._numberStr = ""), (this.value = t.value), this;
- }
- static create(t, e) {
- let i = s.pool.pop();
- return (i = i || new s()), t instanceof s ? i.initByBigNum(t) : i.initByNumber(t, e), i;
- }
- release() {
- s.pool.push(this);
- }
- divide(t) {
- return (
- (this.value = "number" == typeof t ? Math.floor(this.value / t) : Math.floor(this.value / t.value)),
- (this._numberStr = ""),
- this
- );
- }
- divideBigLong(t) {
- return this.value / t.value;
- }
- cmp(t) {
- return "number" == typeof t ? this.value - t : this.value - t.value;
- }
- add(t) {
- return (
- (this.value = "number" == typeof t ? Math.floor(this.value + t) : Math.floor(this.value + t.value)),
- (this._numberStr = ""),
- this
- );
- }
- sub(t) {
- return (
- (this.value = "number" == typeof t ? Math.floor(this.value - t) : Math.floor(this.value - t.value)),
- (this._numberStr = ""),
- this
- );
- }
- static toString(o) {
- if (o < 1e3) return Math.floor(o) + "";
- {
- let t = o.toPrecision(3),
- e = t.split("e+"),
- i = parseInt(e[1]),
- s = i % 3;
- return (
- (i -= s),
- s < 2
- ? (t = t.replace(".", "")).slice(0, 1 + s) + "." + t.slice(1 + s, 3) + a[i / 3]
- : t.replace(".", "").slice(0, 1 + s) + a[i / 3]
- );
- }
- }
- static unpackData(t) {
- var e = t.match(/(-?)([\d.]+)([a-z]{2}|M|K|T|B)?/);
- if (e) {
- if (e[3]) {
- t = a.indexOf(e[3]);
- return parseFloat(e[2]) * Math.pow(10, 3 * t);
- }
- return parseFloat(e[2]);
- }
- return 0;
- }
- toString() {
- if (this._numberStr) return this._numberStr;
- if (this.value < 1e3) return (this._numberStr = this.value + "");
- {
- let t = this.value.toPrecision(3),
- e = t.split("e+"),
- i = parseInt(e[1]),
- s = i % 3;
- return (
- (i -= s),
- s < 2
- ? ((t = t.replace(".", "")),
- (this._numberStr = t.slice(0, 1 + s) + "." + t.slice(1 + s, 3) + a[i / 3]))
- : (this._numberStr = t.replace(".", "").slice(0, 1 + s) + a[i / 3])
- );
- }
- }
- multiply(t) {
- return (
- (this.value = "number" == typeof t ? Math.floor(this.value * t) : Math.floor(this.value * t.value)),
- (this._numberStr = ""),
- this
- );
- }
- getMultiplyValue(t) {
- let o = 0;
- if ((o = "number" == typeof t ? Math.floor(this.value * t) : Math.floor(this.value * t.value)) < 1e3)
- return o + "";
- {
- let t = o.toPrecision(3),
- e = t.split("e+"),
- i = parseInt(e[1]),
- s = i % 3;
- return (
- (i -= s),
- s < 2
- ? (t = t.replace(".", "")).slice(0, 1 + s) + "." + t.slice(1 + s, 3) + a[i / 3]
- : t.replace(".", "").slice(0, 1 + s) + a[i / 3]
- );
- }
- }
- copy() {
- return s.create(this);
- }
- isZero() {
- return 0 === this.value;
- }
- clear() {
- (this.value = 0), (this._numberStr = "0");
- }
- getData() {
- return [this.value];
- }
- unPackData(t) {
- (this._numberStr = ""), (this.value = t[0]);
- }
- }
- (i.default = s), (s.pool = []), (s.tempNum = s.create(0, 0)), (window.MyBigLong = s);
|