@greymass/eosio
Advanced tools
Comparing version 0.1.7 to 0.1.8
/** | ||
* EOSIO Core v0.1.7 | ||
* EOSIO Core v0.1.8 | ||
* https://github.com/greymass/eosio-core | ||
@@ -147,3 +147,3 @@ * | ||
* Convert floating point to units according to symbol precision. | ||
* @throws If the resulting units can't be represented in 53 bits. | ||
* Note that the value will be rounded to closest precision. | ||
**/ | ||
@@ -150,0 +150,0 @@ convertFloat(float: number): Int64; |
{ | ||
"name": "@greymass/eosio", | ||
"description": "Library for working with EOSIO blockchains", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"homepage": "https://github.com/greymass/eosio-core", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
@@ -186,11 +186,6 @@ import BN from 'bn.js' | ||
* Convert floating point to units according to symbol precision. | ||
* @throws If the resulting units can't be represented in 53 bits. | ||
* Note that the value will be rounded to closest precision. | ||
**/ | ||
convertFloat(float: number): Int64 { | ||
const p = this.precision | ||
const rv = Math.pow(10, p) * float | ||
if (rv >= 0x20000000000000) { | ||
throw new Error('Conversion looses precision') | ||
} | ||
return Int64.from(rv.toFixed(p).split('.')[0]) | ||
return Int64.from(float.toFixed(this.precision).replace('.', '')) | ||
} | ||
@@ -197,0 +192,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
725856
14343