Skip to content

Commit

Permalink
fix: fix linter issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiorigam committed Oct 31, 2024
1 parent 155ffe8 commit 07dba86
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 10 additions & 7 deletions src/1.Hello_World/FinancialMath.ts
Original file line number Diff line number Diff line change
@@ -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()}`);
Expand All @@ -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()}`);
// }

0 comments on commit 07dba86

Please sign in to comment.