@cjhd/cj-decimal 1.0.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cj-package.json +13 -0
- package/assets/Decimal.js +6 -0
- package/bin/package-postinstall.js +32 -0
- package/encrypted-payload/files/assets__Decimal.js.bin +0 -0
- package/encrypted-payload/files/index.js.bin +1 -0
- package/encrypted-payload/manifest.json +29 -0
- package/index.js +6 -0
- package/package.json +34 -17
- package/dist/cocos/assets/Decimal.js +0 -4
- package/dist/cocos/index.js +0 -4
package/.cj-package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "cj-package-v1",
|
|
3
|
+
"name": "@cjhd/cj-decimal",
|
|
4
|
+
"version": "1.1.2",
|
|
5
|
+
"payloadManifest": "encrypted-payload/manifest.json",
|
|
6
|
+
"entry": "index.js",
|
|
7
|
+
"assetsDir": "assets",
|
|
8
|
+
"generatedFiles": [
|
|
9
|
+
"assets/Decimal.js",
|
|
10
|
+
"index.js"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": []
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function __cjLicenseError() {
|
|
2
|
+
throw new Error("[CJHD License] Runtime package is not unlocked. Expected license file: extensions/pkg/node_modules/@cjhd/cj-cocos-license/bin/cj-runtime-license.json. Then run: node extensions/pkg/node_modules/@cjhd/cj-cocos-license/bin/cj-license.js --mode install --force");
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export class Decimal { constructor() { __cjLicenseError(); } }
|
|
6
|
+
export function __cj_package_not_unlocked__() { __cjLicenseError(); }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import childProcess from 'node:child_process';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
8
|
+
const cjhdRoot = path.dirname(packageRoot);
|
|
9
|
+
const pkgRoot = path.resolve(cjhdRoot, '../..');
|
|
10
|
+
const cli = path.join(cjhdRoot, 'cj-cocos-license', 'bin', 'cj-license.js');
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(cli)) {
|
|
13
|
+
console.warn('[CJHD License] @cjhd/cj-cocos-license is not installed; keeping unauthorized stubs.');
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const result = childProcess.spawnSync(process.execPath, [
|
|
18
|
+
cli,
|
|
19
|
+
'--mode',
|
|
20
|
+
'install',
|
|
21
|
+
'--soft',
|
|
22
|
+
'--pkg-root',
|
|
23
|
+
pkgRoot
|
|
24
|
+
], {
|
|
25
|
+
cwd: pkgRoot,
|
|
26
|
+
stdio: 'inherit',
|
|
27
|
+
shell: false
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (result.status !== 0) {
|
|
31
|
+
console.warn('[CJHD License] install unlock check did not complete; keeping unauthorized stubs.');
|
|
32
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a���ケǷ��������`��٣�g'E�|�Kʱ`�`َ[|I�
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "cj-encrypted-payload-v1",
|
|
3
|
+
"packageName": "@cjhd/cj-decimal",
|
|
4
|
+
"packageVersion": "1.1.2",
|
|
5
|
+
"algorithm": "AES-256-GCM",
|
|
6
|
+
"kdf": "HKDF-SHA256",
|
|
7
|
+
"sourceHash": "ef241625808b93480b2c4e880901e9b8345081fef968b4f4f6669a25bda2cd77",
|
|
8
|
+
"payloadHash": "d6921a00f2e48c3faa51fa369d82d5aa5d45f9463aba87c57ee9f00d698eb926",
|
|
9
|
+
"files": [
|
|
10
|
+
{
|
|
11
|
+
"out": "assets/Decimal.js",
|
|
12
|
+
"bin": "files/assets__Decimal.js.bin",
|
|
13
|
+
"iv": "cRNtEXix0DUozEka",
|
|
14
|
+
"authTag": "sMMEmUaAqR8Z6W8cO3Ej5A==",
|
|
15
|
+
"sha256": "c920e2ec189a291f8afab44929faf901d018c11c7f9d49cf14467f9c9f7646e5"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"out": "index.js",
|
|
19
|
+
"bin": "files/index.js.bin",
|
|
20
|
+
"iv": "qz7+q4JWi8k9IT0/",
|
|
21
|
+
"authTag": "7wQ5pZBy5H1E+oqqjG7juQ==",
|
|
22
|
+
"sha256": "1f4ad00b8da4e8d0a211500507f63f6031ccfb0fb89d2c0e4d8184fc6d1cfa05"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"publicExports": [
|
|
26
|
+
"Decimal"
|
|
27
|
+
],
|
|
28
|
+
"createdAt": "2026-05-20T02:39:02.234Z"
|
|
29
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function __cjLicenseError() {
|
|
2
|
+
throw new Error("[CJHD License] Runtime package is not unlocked. Expected license file: extensions/pkg/node_modules/@cjhd/cj-cocos-license/bin/cj-runtime-license.json. Then run: node extensions/pkg/node_modules/@cjhd/cj-cocos-license/bin/cj-license.js --mode install --force");
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export { Decimal } from './assets/Decimal.js';
|
|
6
|
+
export function __cj_package_not_unlocked__() { __cjLicenseError(); }
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cjhd/cj-decimal",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"engine": ">=3.8.0",
|
|
3
|
+
"version": "1.1.2",
|
|
5
4
|
"description": "定点数学计算模块",
|
|
6
|
-
"main": "./
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "node ./bin/package-postinstall.js"
|
|
8
|
+
},
|
|
7
9
|
"repository": {
|
|
8
10
|
"type": "git",
|
|
9
11
|
"url": "https://gitee.com/cocos2d-zp/cococs-creator-frame-3d"
|
|
@@ -13,28 +15,43 @@
|
|
|
13
15
|
"registry": "https://registry.npmjs.org"
|
|
14
16
|
},
|
|
15
17
|
"author": "超M <402879660@qq.com>",
|
|
16
|
-
"license": "
|
|
17
|
-
"
|
|
18
|
-
"browser": "./
|
|
18
|
+
"license": "SEE LICENSE IN README.md",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"browser": "./index.js",
|
|
19
21
|
"types": "./index.d.ts",
|
|
20
22
|
"exports": {
|
|
21
23
|
".": {
|
|
22
24
|
"types": "./index.d.ts",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"default": "./
|
|
25
|
+
"browser": "./index.js",
|
|
26
|
+
"import": "./index.js",
|
|
27
|
+
"default": "./index.js"
|
|
26
28
|
},
|
|
27
29
|
"./assets/*": {
|
|
28
|
-
"
|
|
29
|
-
"browser": "./
|
|
30
|
-
"
|
|
31
|
-
|
|
30
|
+
"types": "./assets/*.d.ts",
|
|
31
|
+
"browser": "./assets/*.js",
|
|
32
|
+
"import": "./assets/*.js",
|
|
33
|
+
"default": "./assets/*.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
32
36
|
},
|
|
33
37
|
"files": [
|
|
34
|
-
"dist/",
|
|
35
|
-
"**/*.d.ts",
|
|
36
38
|
"package.json",
|
|
37
39
|
"README.md",
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
+
"index.d.ts",
|
|
41
|
+
"index.js",
|
|
42
|
+
"assets/**/*.d.ts",
|
|
43
|
+
"assets/**/*.js",
|
|
44
|
+
"encrypted-payload/**",
|
|
45
|
+
"bin/**",
|
|
46
|
+
".cj-package.json"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@cjhd/cj-cocos-license": "^1.0.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"@cjhd/cj-cocos-license": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
40
57
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/* CJ_RUNTIME_PROTECTED_JS */
|
|
2
|
-
"use strict";
|
|
3
|
-
var __cj_sa_8990661f=["57.29577951308232","0.19999967200053792","0.14285489799446008","1.5707963267948966","cc/env"];
|
|
4
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Decimal=void 0;const env_1=require(__cj_sa_8990661f[4]);let DotLen=8,Scale=Math.pow(10,DotLen),Scale_L=Math.pow(10,DotLen-1);function decimalStr(t){const i=t.length;return i===DotLen?t:i>DotLen?t.slice(0,DotLen):t+"0".repeat(DotLen-i)}function intDiv(t,i){return t<i?0:t===i?1:Math.floor(t/i)}function intMod(t,i){return t<i?t:t===i?0:t-intDiv(t,i)*i}function mulFractionToScaledFloor(t,i){const e=1e4,s=intDiv(t,e),n=t-s*e,r=intDiv(i,e),a=i-r*e;return s*r+intDiv((s*a+n*r)*e+n*a,1e8)}const BigIntCtor="function"==typeof globalThis.BigInt?globalThis.BigInt:void 0;class Decimal{static copy(t){return(new Decimal).copy(t)}static createInt(t){return(new Decimal).setInt(t)}static createFloat(t){return(new Decimal).setFloat(t)}static create(t,i,e){return(new Decimal).set(t,i,e)}static set accuracy(t){DotLen=Math.max(Math.floor(t),1),Scale=Math.pow(10,DotLen),Scale_L=Math.pow(10,DotLen-1),PI_Decimal.setFloat("3.141592653589793"),PI_HALF_Decimal.setFloat("1.5707963267948966"),Deg_Rad_Decimal.setFloat("0.017453292519943"),Rad_Deg_Decimal.setFloat(__cj_sa_8990661f[0])}static get accuracy(){return DotLen}static get PI(){return PI_Decimal}static get PI_HALF(){return PI_HALF_Decimal}static get DEG_TO_RAD(){return Deg_Rad_Decimal}static get RAD_TO_DEG(){return Rad_Deg_Decimal}static get zero(){return new Decimal}static get ZERO(){return Zero_Decimal.sign=1,Zero_Decimal.v1=0,Zero_Decimal.v2=0,Zero_Decimal}static get one(){return Decimal.createInt(1)}static get ONE(){return One_Decimal.sign=1,One_Decimal.v1=1,One_Decimal.v2=0,One_Decimal}static get two(){return Decimal.createInt(2)}static get TWO(){return Two_Decimal.sign=1,Two_Decimal.v1=2,Two_Decimal.v2=0,Two_Decimal}static get(){return Decimal.createInt(-1)}static get MINUS(){return Minus_Decimal.sign=-1,Minus_Decimal.v1=1,Minus_Decimal.v2=0,Minus_Decimal}static get NaN(){return Decimal.create(1,Number.NaN,Number.NaN)}static max(...t){let i=t[0];for(let e=1;e<t.length;e++){const s=t[e];s.GT(i)&&(i=s)}return i}static min(...t){let i=t[0];for(let e=1;e<t.length;e++){const s=t[e];s.LT(i)&&(i=s)}return i}static radiansToDegrees(t,i){return t.copy(i).mul(this.RAD_TO_DEG)}static degreesToRadians(t,i){return t.copy(i).mul(this.DEG_TO_RAD)}static sin(t,i){return this.cos(t,TempB1.copy(i).addInt(90)).negative()}static cos(t,i){const e=TempB1.copy(i).modInt(360).mul(this.DEG_TO_RAD),s=t.copy(this.ONE),n=TempB2.setInt(1);for(let t=1;t<=9;t++)n.mul(e).mul(e).negative().divInt(2*t*(2*t-1)),s.add(n);return s}static tan(t,i){const e=this.sin(t,i),s=this.cos(TempB3,i);return e.div(s)}static asin(t,i){return TempB1.copy(i).pow().negative().add(this.ONE).sqrt(),TempB2.copy(i).div(TempB1),this.atan(t,TempB2)}static acos(t,i){return i.LT(this.MINUS)||i.GT(this.ONE)?t.set(1,Number.NaN,Number.NaN):i.EQ(this.ONE)?t.set(1,0,0):i.EQ(this.ZERO)?t.set(1,90,0):i.EQ(this.MINUS)?t.set(1,180,0):(TempB1.copy(i).pow().negative().add(this.ONE).sqrt().div(i),this.atan(t,TempB1).modInt(180),t.isNegative()?t.addInt(180):t)}static atan(t,i){if(i.EQ(this.ZERO))return t.copy(this.ZERO);if(1===i.v1&&0===i.v2)return t.set(i.sign,45,0);let e=1,s=!1,n=!1;if(t.copy(i).isNegative()&&(e=-1,t.negative()),t.GT(this.ONE)&&(t.reciprocal(),s=!0),t.GTFloat("0.26794919")){const i=TempC1.setFloat("1.7320508075688772");TempC2.copy(t).add(i),t.mul(i).sub(this.ONE).div(TempC2),n=!0}return TempC1.copy(t).sub(TempC2.setFloat("0.3333333342477778").mul(TempC3.copy(t).pow(3))).add(TempC2.setFloat(__cj_sa_8990661f[1]).mul(TempC3.mul(t).mul(t))).add(TempC2.setFloat("0.11108765927193148").mul(TempC3.mul(t))).sub(TempC2.setFloat(__cj_sa_8990661f[2]).mul(TempC3.mul(t))).sub(TempC2.setFloat("0.0849762066621346").mul(TempC3.mul(t))),t.copy(TempC1),n&&t.addFloat("0.5235987755982988"),s&&t.sub(this.PI_HALF).negative(),t.sign*=e,t.mul(this.RAD_TO_DEG)}static atan2(t,i,e){return e.EQ(this.ZERO)&&i.EQ(this.ZERO)?t.copy(this.ZERO):e.GT(this.ZERO)?this.atan(t,TempD1.copy(i).div(e)):e.LT(this.ZERO)&&i.GE(this.ZERO)?this.atan(t,TempD1.copy(i).div(e)).addInt(180):e.LT(this.ZERO)&&i.LT(this.ZERO)?this.atan(t,TempD1.copy(i).div(e)).subInt(180):e.EQ(this.ZERO)&&i.GT(this.ZERO)?t.setInt(90):t.setInt(-90)}get sign(){return this._sign}set sign(t){this._sign=t}get v1(){return this._v1}set v1(t){this._v1=t}get v2(){return this._v2}set v2(t){this._v2=t}bindMutationObserver(t){return this.__observer=t,t||(this.__mutationDepth=0,this.__mutationPending=!1),this}beginMutationBatch(){return this.__observer&&0===this.__silentDepth&&this.__mutationDepth++,this}endMutationBatch(){return this.__observer&&0===this.__silentDepth&&this.__mutationDepth>0&&(this.__mutationDepth--,this.flushMutationObserverIfReady()),this}runMutationBatch(t){this.beginMutationBatch();try{return t()}finally{this.endMutationBatch()}}runSilentMutation(t){this.__silentDepth++;try{return t()}finally{this.__silentDepth--}}setSilent(t=1,i=0,e=0){return this.runSilentMutation(()=>this.set(t,i,e))}copySilent(t){return this.runSilentMutation(()=>this.copy(t))}static compareAbs(t,i){return t.v1>i.v1?1:t.v1<i.v1?-1:t.v2>i.v2?1:t.v2<i.v2?-1:0}static compareSigned(t,i){if(t.sign!==i.sign)return t.sign>i.sign?1:-1;const e=Decimal.compareAbs(t,i);return 1===t.sign?e:0===e?0:e>0?-1:1}normalizeZero(){return 0===this.v1&&0===this.v2&&(this.sign=1),this}snapshot(){return{sign:this.sign,v1:this.v1,v2:this.v2}}changedSince(t){return!Object.is(this.sign,t.sign)||!Object.is(this.v1,t.v1)||!Object.is(this.v2,t.v2)}runMutation(t){if(!this.__observer||this.__silentDepth>0)return t();const i=this.snapshot();this.__mutationDepth++;try{return t()}finally{this.changedSince(i)&&(this.__mutationPending=!0),this.__mutationDepth--,this.flushMutationObserverIfReady()}}flushMutationObserverIfReady(){if(0!==this.__mutationDepth||!this.__mutationPending||this.__silentDepth>0)return;this.__mutationPending=!1;const t=this.__observer;t&&t.onDecimalMutated(this)}setAbsSub(t,i,e,s,n){let r=i-s,a=e-n;return a<0&&(a+=Scale,r-=1),this.sign=t,this.v1=r,this.v2=a,this.normalizeZero()}setAbsAdd(t,i,e,s,n){let r=i+s,a=e+n;return a>=Scale&&(a-=Scale,r+=1),this.sign=t,this.v1=r,this.v2=a,this.normalizeZero()}setFromRawBigInt(t){if(!BigIntCtor)return this.set(1,Number.NaN,Number.NaN);const i=BigIntCtor(0),e=BigIntCtor(Scale);let s=1;return t<i&&(s=-1,t=-t),this.sign=s,this.v1=Number(t/e),this.v2=Number(t%e),this.normalizeZero()}set value(t){this.runMutation(()=>{this.sign=t.sign,this.v1=t.v1,this.v2=t.v2})}constructor(t){this._sign=1,this._v1=0,this._v2=0,this.__observer=null,this.__mutationDepth=0,this.__mutationPending=!1,this.__silentDepth=0,this.setFloat(t)}set(t=1,i=0,e=0){return this.runMutation(()=>(this.sign=t,this.v1=i,this.v2=e,this))}setFloat(t=""){return this.runMutation(()=>{if(!t)return this.sign=1,this.v1=0,this.v2=0,this;this.sign="-"===t[0]?-1:1;const i=t.split(".");return this.v1=Math.abs(parseInt(i[0]||"0")),this.v2=1===i.length?0:parseInt(decimalStr(i[1])),0===this.v1&&0===this.v2&&(this.sign=1),this})}setInt(t=0){return this.runMutation(()=>(env_1.DEV&&t!==Math.floor(t)&&console.error("setInt: 参数必须是整数,而不应该是",t),t<0?(this.sign=-1,this.v1=Math.floor(-t),this.v2=0):(this.sign=1,this.v1=Math.floor(t),this.v2=0),this))}copy(t){return this.runMutation(()=>(this.sign=t.sign,this.v1=t.v1,this.v2=t.v2,this))}toNumber(t=!1){return t?parseFloat(this.toString()):this.sign*(this.v1+this.v2/Scale)}toString(){return 1===this.sign?this.v1.toString()+"."+"0".repeat(DotLen-this.v2.toString().length)+this.v2:"-"+this.v1.toString()+"."+"0".repeat(DotLen-this.v2.toString().length)+this.v2}toBigInt(){return this.sign*(this.v1*Scale+this.v2)}isZero(){return 0===this.v1&&0===this.v2}isNegative(){return this.sign<0&&(this.v1>0||this.v2>0)}isNaN(){return Number.isNaN(this.v1)||Number.isNaN(this.v2)}clone(){return(new Decimal).copy(this)}floor(){return this.runMutation(()=>(this.v2>0&&-1===this.sign&&(this.v1+=1),this.v2=0,this))}ceil(){return this.runMutation(()=>(this.v2>0&&1===this.sign&&(this.v1+=1),this.v2=0,0===this.v1&&(this.sign=1),this))}round(){return this.runMutation(()=>(this.v2>Scale>>1&&(this.v1+=1),this.v2=0,0===this.v1&&(this.sign=1),this))}abs(){return this.runMutation(()=>(this.sign=1,this))}reverse(){return this.runMutation(()=>(this.sign*=-1,this))}negative(){return this.runMutation(()=>(this.sign*=-1,this))}reciprocal(){return this.runMutation(()=>this.copy(Decimal.ONE.div(this)))}add(t){return this.runMutation(()=>{if(this.sign===t.sign)return this.setAbsAdd(this.sign,this.v1,this.v2,t.v1,t.v2);const i=Decimal.compareAbs(this,t);return 0===i?this.set():i>0?this.setAbsSub(this.sign,this.v1,this.v2,t.v1,t.v2):this.setAbsSub(t.sign,t.v1,t.v2,this.v1,this.v2)})}addInt(t){return this.add(Temp.setInt(t))}addFloat(t){return this.add(Temp.setFloat(t))}sub(t){return this.runMutation(()=>{if(this.sign!==t.sign)return this.setAbsAdd(this.sign,this.v1,this.v2,t.v1,t.v2);const i=Decimal.compareAbs(this,t);return 0===i?this.set():i>0?this.setAbsSub(this.sign,this.v1,this.v2,t.v1,t.v2):this.setAbsSub(1===this.sign?-1:1,t.v1,t.v2,this.v1,this.v2)})}subInt(t){return this.sub(Temp.setInt(t))}subFloat(t){return this.sub(Temp.setFloat(t))}mul(t){return this.runMutation(()=>{const i=this.sign===t.sign?1:-1;let e=this.v1*t.v1,s=0,n=this.v1*t.v2;return e+=intDiv(n,Scale),s+=intMod(n,Scale),s>=Scale&&(e+=intDiv(s,Scale),s=intMod(s,Scale)),n=this.v2*t.v1,e+=intDiv(n,Scale),s+=intMod(n,Scale),s>=Scale&&(e+=intDiv(s,Scale),s=intMod(s,Scale)),s+=mulFractionToScaledFloor(this.v2,t.v2),s>=Scale&&(e+=intDiv(s,Scale),s=intMod(s,Scale)),this.sign=i,this.v1=e,this.v2=s,this.normalizeZero()})}mulInt(t){return this.mul(Temp.setInt(t))}mulFloat(t){return this.mul(Temp.setFloat(t))}div(t){return this.runMutation(()=>{const i=t.v1*Scale+t.v2;if(0===i)return this.set(1,Number.NaN,Number.NaN);const e=this.sign===t.sign?1:-1;if(BigIntCtor){const i=BigIntCtor(Scale),s=(BigIntCtor(this.v1)*i+BigIntCtor(this.v2))*i/(BigIntCtor(t.v1)*i+BigIntCtor(t.v2))*BigIntCtor(e);return this.setFromRawBigInt(s)}const s=this.v1*Scale+this.v2,n=intDiv(s,i),r=intDiv((s-n*i)*Scale,i);return this.sign=e,this.v1=n,this.v2=r,this.normalizeZero()})}divInt(t){return this.div(Temp.setInt(t))}divFloat(t){return this.div(Temp.setFloat(t))}mod(t){return this.runMutation(()=>{const i=t.v1*Scale+t.v2;if(0===i)return this.set(1,Number.NaN,Number.NaN);if(Decimal.compareAbs(this,t)<0)return this;if(0===Decimal.compareAbs(this,t))return this.set();if(BigIntCtor){const i=BigIntCtor(Scale),e=BigIntCtor(this.v1)*i+BigIntCtor(this.v2),s=BigIntCtor(t.v1)*i+BigIntCtor(t.v2);return this.setFromRawBigInt(e%s*BigIntCtor(this.sign))}const e=intMod(this.v1*Scale+this.v2,i);return this.v1=intDiv(e,Scale),this.v2=intMod(e,Scale),this.normalizeZero()})}modInt(t){return this.mod(Temp.setInt(t))}modFloat(t){return this.mod(Temp.setFloat(t))}pow(t=2){return this.runMutation(()=>{if(0===t)this.sign=1,this.v1=1,this.v2=0;else{if(1===t)return this;if(2===t)this.mul(TempA1.copy(this));else if(t>0){const i=TempA1.copy(this);for(let e=1;e<t;e++)this.mul(i)}else{const i=TempA1.copy(this);this.sign=1,this.v1=1,this.v2=0;for(let e=-1;e>=t;e--)this.div(i)}}return this})}sqrt(){return this.runMutation(()=>{if(this.LE(Zero_Decimal))return this.set(1,Number.NaN,Number.NaN);const t=5*Scale_L,i=TempA2.copy(this).div(TempA1.copy(Decimal.TWO)),e=TempA3.copy(this).div(TempA1.copy(Decimal.TWO).mul(i)).add(TempA1.set(1,0,t).mul(i));for(;TempA1.copy(e).sub(i).abs().GT(Threshold_Decimal);)i.copy(e),e.copy(this).div(TempA1.copy(Decimal.TWO).mul(i)).add(TempA1.set(1,0,t).mul(i));return this.sign=e.sign,this.v1=e.v1,this.v2=e.v2,this})}LT(t){return Decimal.compareSigned(this,t)<0}"<"(t){return Decimal.compareSigned(this,t)<0}LTInt(t){return this.LT(Temp.setInt(t))}LTFloat(t){return this.LT(Temp.setFloat(t))}LE(t){return Decimal.compareSigned(this,t)<=0}"<="(t){return Decimal.compareSigned(this,t)<=0}LEInt(t){return this.LE(Temp.setInt(t))}LEFloat(t){return this.LE(Temp.setFloat(t))}EQ(t){return this.sign===t.sign&&this.v1===t.v1&&this.v2===t.v2}"=="(t){return this.EQ(t)}EQInt(t){return this.EQ(Temp.setInt(t))}EQFloat(t){return this.EQ(Temp.setFloat(t))}NE(t){return!this.EQ(t)}"!="(t){return!this.EQ(t)}NEInt(t){return this.NE(Temp.setInt(t))}NEFloat(t){return this.NE(Temp.setFloat(t))}GT(t){return Decimal.compareSigned(this,t)>0}">"(t){return Decimal.compareSigned(this,t)>0}GTInt(t){return this.GT(Temp.setInt(t))}GTFloat(t){return this.GT(Temp.setFloat(t))}GE(t){return Decimal.compareSigned(this,t)>=0}">="(t){return Decimal.compareSigned(this,t)>=0}GEInt(t){return this.GE(Temp.setInt(t))}GEFloat(t){return this.GE(Temp.setFloat(t))}}exports.Decimal=Decimal;const Temp=new Decimal,Temp1=new Decimal,Temp2=new Decimal,TempA1=new Decimal,TempA2=new Decimal,TempA3=new Decimal,TempB1=new Decimal,TempB2=new Decimal,TempB3=new Decimal,TempC1=new Decimal,TempC2=new Decimal,TempC3=new Decimal,TempD1=new Decimal,Threshold_Decimal=Decimal.create(1,0,1),Zero_Decimal=Decimal.createInt(0),One_Decimal=Decimal.createInt(1),Two_Decimal=Decimal.createInt(2),Minus_Decimal=Decimal.createInt(-1),PI_Decimal=Decimal.createFloat("3.141592653589793"),PI_HALF_Decimal=Decimal.createFloat(__cj_sa_8990661f[3]),Deg_Rad_Decimal=Decimal.createFloat("0.017453292519943"),Rad_Deg_Decimal=Decimal.createFloat("57.29577951308232");
|
package/dist/cocos/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/* CJ_RUNTIME_PROTECTED_JS */
|
|
2
|
-
"use strict";
|
|
3
|
-
var __cj_sa_e696be72=["./assets/Decimal"];
|
|
4
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Decimal=void 0;var Decimal_1=require(__cj_sa_e696be72[0]);Object.defineProperty(exports,"Decimal",{enumerable:!0,get:function(){return Decimal_1.Decimal}});
|