diff --git a/package.json b/package.json index c99f162..edccd58 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,9 @@ "@eslint/js": "^9.12.0", "commitlint": "^19.5.0", "eslint": "^9.12.0", - "eslint-config-prettier": "^9.1.0", "eslint-config-love": "^v87.0.0", + "eslint-config-prettier": "^9.1.0", + "eslint-config-standard-with-typescript": "^43.0.1", "eslint-plugin-import": "^2.31.0", "eslint-plugin-n": "^17.11.1", "eslint-plugin-prettier": "^5.2.1", diff --git a/src/1.Hello_World/FinancialMath.ts b/src/1.Hello_World/FinancialMath.ts index aa11199..74707bb 100644 --- a/src/1.Hello_World/FinancialMath.ts +++ b/src/1.Hello_World/FinancialMath.ts @@ -1,22 +1,26 @@ -import {FixedPointNumber} from '@vechain/sdk-core'; +import { FixedPointNumber } from '@vechain/sdk-core'; import { BigNumber } from 'bignumber.js'; let x = FixedPointNumber.of(123.456789); let y = FixedPointNumber.of('123.456789'); -console.log(`FPN value ${x} from number is ${x.isEqual(y) ? '' : 'not'}equal to ${y} from string.`); +console.log( + `FPN value ${x} from number is ${x.isEqual(y) ? '' : 'not'}equal to ${y} from string.` +); console.log(`Cast FPN value to number is ${x.n}.`); console.log(`Cast FPN value to bigint is ${x.bi}.`); x = FixedPointNumber.of(1); y = FixedPointNumber.of(3); let r = x.div(y); -console.log(`FPN value = ${r}; JS value = ${x.n/y.n}; BigNumber value = ${BigNumber(x.n).div(y.n)}.`); -x = x.dp(80) // must be updated +console.log( + `FPN value = ${r}; JS value = ${x.n / y.n}; BigNumber value = ${BigNumber(x.n).div(y.n)}.` +); +x = x.dp(80); // must be updated r = x.div(y); console.log(`${r}`); -let dp = 20; -for(let n = 0; n <= 8; n ++) { +const dp = 20; +for (let n = 0; n <= 8; n++) { x = FixedPointNumber.of(n, BigInt(dp)); r = x.sqrt(); console.log(`${n}, ${r};\t${Math.sqrt(n)};\t${BigNumber(n).dp(dp).sqrt()}`); @@ -28,4 +32,3 @@ for(let n = 0; n <= 8; n ++) { // r = x.sqrt(); // console.log(`${n}, ${r};\t${Math.sqrt(n)};\t${BigNumber(n).dp(dp).sqrt()}`); // } -