Просмотр исходного кода

update dashu new 0.3 api from main repo

police 3 лет назад
Родитель
Сommit
e4cb9aca8d
4 измененных файлов с 57 добавлено и 15 удалено
  1. 53 10
      Cargo.lock
  2. 2 3
      Cargo.toml
  3. 1 1
      src/consensus/types.rs
  4. 1 1
      src/error.rs

+ 53 - 10
Cargo.lock

@@ -1359,37 +1359,45 @@ dependencies = [
 
 [[package]]
 name = "dashu"
-version = "0.2.0"
-source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51a1b5a00793e3ac2239993ef582603764bcb333a4d04c2a0944639a7e916c85"
 dependencies = [
  "dashu-base",
  "dashu-float",
  "dashu-int",
  "dashu-macros",
+ "dashu-ratio",
 ]
 
 [[package]]
 name = "dashu-base"
-version = "0.2.0"
-source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f2585452b8ecf7c874045dba02a7914b7e5b2e3cdd5e152573413aa290197aa"
 
 [[package]]
 name = "dashu-float"
-version = "0.2.0"
-source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc95c80c23468b344fa4c58ca93b3a61ca73081e5ccfba3807a034eb72a62c25"
 dependencies = [
  "dashu-base",
  "dashu-int",
+ "num-traits",
+ "rand",
  "static_assertions",
 ]
 
 [[package]]
 name = "dashu-int"
-version = "0.2.0"
-source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57a1009a3ce0c4c64e977c5e7dd8c475278750e145cbb8956d1e28832f557975"
 dependencies = [
  "cfg-if",
  "dashu-base",
+ "num-order",
  "num-traits",
  "rand",
  "static_assertions",
@@ -1397,16 +1405,31 @@ dependencies = [
 
 [[package]]
 name = "dashu-macros"
-version = "0.2.0"
-source = "git+https://github.com/ertosns/dashu#dffdb0b2a499d96bb08bde7a2bcf6a3ebf99b602"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6fc2425b6724a7d5bfc8e57044e231803b5fc3a7283d6efbff34bfab6ebe014"
 dependencies = [
  "dashu-base",
  "dashu-float",
  "dashu-int",
+ "dashu-ratio",
  "proc-macro2",
  "quote",
 ]
 
+[[package]]
+name = "dashu-ratio"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "246e3acb67e430b98740d1c5ccc53ade472c6e38b430c7e6759aafbee4ca424c"
+dependencies = [
+ "dashu-base",
+ "dashu-float",
+ "dashu-int",
+ "num-traits",
+ "rand",
+]
+
 [[package]]
 name = "dchat"
 version = "0.4.1"
@@ -2771,6 +2794,26 @@ dependencies = [
  "num-traits",
 ]
 
+[[package]]
+name = "num-modular"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64a5fe11d4135c3bcdf3a95b18b194afa9608a5f6ff034f5d857bc9a27fb0119"
+dependencies = [
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-order"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e81e321057a0370997b13e6638bba6bd7f6f426e1f8e9a2562490a28eb23e1bc"
+dependencies = [
+ "num-modular",
+ "num-traits",
+]
+
 [[package]]
 name = "num-rational"
 version = "0.4.1"

+ 2 - 3
Cargo.toml

@@ -83,9 +83,8 @@ serde = {version = "1.0.152", features = ["derive"], optional = true}
 structopt = {version= "0.3.26", optional = true}
 structopt-toml = {version= "0.5.1", optional = true}
 toml = {version = "0.7.1", optional = true}
-# big float
-dashu = { version = "0.2.0", git = "https://github.com/ertosns/dashu", optional=true }
-
+# Big float high precision arithmetics
+dashu = { version = "0.3.0", optional=true }
 # Utilities
 # TODO: check chrono usage and impl our own
 chrono = {version = "0.4.23", optional = true}

+ 1 - 1
src/consensus/types.rs

@@ -41,7 +41,7 @@ impl Float10 {
     }
 
     pub fn powf(&self, exp: Self) -> Self {
-        Self(self.0.powf(exp.0))
+        Self(self.0.powf(&exp.0))
     }
 
     pub fn ln(&self) -> Self {

+ 1 - 1
src/error.rs

@@ -61,7 +61,7 @@ pub enum Error {
 
     #[cfg(feature = "dashu")]
     #[error(transparent)]
-    DashuParseError(#[from] dashu::integer::error::ParseError),
+    DashuParseError(#[from] dashu::base::error::ParseError),
 
     // ===============
     // Encoding errors