-
Notifications
You must be signed in to change notification settings - Fork 279
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
Arbitrary precision arithmetic by default #3660
Comments
Integer
I think the inspiration here is something like |
Just like 10^18 wei for ETH, what if the resolution of the base unit for the named unit is determined on the asset definition creation and only the number of base units is calculated internally? |
@Erigara I think you should write what we've decided to do about this since the description of the ticket no longer matches what is being implemented |
@mversic sure. After some dissuasion we decided to provide numeric type for Assets similar to commonly encountered NUMERIC type in relational databases (Postgre, MySql, Oracle). This type is decimal point number which provides 2 parameters:
From the user point of view it would look like this:
Encoding:
|
…` for `Asset`s Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…ic!` Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…ic!` Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…` for `Asset`s Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…ic!` Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…ic!` Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…` for `Asset`s Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…ic!` Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…ic!` Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…` for `Asset`s Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
…ic!` Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Feature request
In lieu of providing multiple fixed-width integer types for all assets, we instead should provide a variable width, fixed precision storage system (with re-allocation) that acts like an arbitrary precision number.
So, all numbers are represented as a
Fixed
, where the precision is either unspecified and arbitrary (inmetadata
) or specified at the asset definition creation time and fixed for the duration of the asset's existence.We differentiate between
BinaryFixedPoint
as it is used today andDecimalFixedPoint
. This allows us to bridge the gap between different blockchains.Rules
BinaryFixedPoint
andDecimalFixedPoint
must use arbitrary precision to find the precise answer and use lossy conversions.The text was updated successfully, but these errors were encountered: