-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1113 fixed point number #1227
Merged
Merged
1113 fixed point number #1227
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # packages/core/src/vcdm/Hex.ts # packages/core/src/vcdm/HexInt.ts # packages/core/src/vcdm/index.ts
…pressions # Conflicts: # docs/diagrams/architecture/vcdm.md # packages/core/src/hash/Sha256.ts # packages/core/src/hash/index.ts # packages/core/src/hdnode/hdnode.ts # packages/core/src/vcdm/Hex.ts # packages/core/tests/hash/Sha256.unit.test.ts # packages/core/tests/hash/fixture.ts # packages/core/tests/hash/hash.unit.test.ts
lucanicoladebiasi
added
Type: Feature
Size: Large
Priority: High
dependencies
Pull requests that update a dependency file
labels
Sep 3, 2024
fabiorigam
approved these changes
Sep 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
dependencies
Pull requests that update a dependency file
Priority: High
Size: Large
Type: Documentation
Type: Enhancement
Type: Feature
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The class
packages/core/tests/vcdm/FPN.unit.test.ts
implements the simplest possibile Fixed Point Number math to provide the (minimal, so far) functionalities to express currencies included the ETH and Gas quantities as part of the VeChain Data Model.The class aims to replace dependencies from bignumber.js, bn.js, bigdecimal.js and from the fixed precision math of ethers.js.
The class use bignumber.js as reference and benchmark, albeit it differs for numerical algorithms, FPN uses
bigint
math to limit algorithms to the functionalities strictly available on all JS runtimes,bignmber.js
represents numbers as an array of UInt8Array integer representations, the ratio among elements of the array lead to the represented value, hence FPN is way simpler.The class
packages/core/tests/vcdm/FPN.unit.test.ts
checks the compatibility with bignumber.js.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
yarn test:solo
yarn test:unit
Test Configuration:
Checklist: