Skip to content

Commit 5fe3a07

Browse files
committed
using strictmath::cbrt
1 parent 263ff64 commit 5fe3a07

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sketches-rust"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
authors = ["loyispa <litiegen456250@gmail.com>"]
55
license = "Apache-2.0"
66
edition = "2021"
@@ -10,4 +10,5 @@ homepage = "https://github.com/loyispa/sketches-rust"
1010
description = "Rust implementation of DDSketch."
1111
exclude = [".gitignore"]
1212

13-
[dependencies]
13+
[dependencies]
14+
rust-strictmath = "0.1.1"

src/index_mapping/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::sketch::{Flag, FlagType};
22
use crate::{serde, Error};
3+
use rust_strictmath::cbrt;
34

45
use crate::output::Output;
56

@@ -159,7 +160,7 @@ impl IndexMapping {
159160
* CUBICALLY_INTERPOLATED_MAPPING_A
160161
* CUBICALLY_INTERPOLATED_MAPPING_A
161162
* (index - index.floor());
162-
let p: f64 = ((d1 - (d1 * d1 - 4.0 * d0 * d0 * d0).sqrt()) / 2.0).cbrt();
163+
let p: f64 = cbrt((d1 - (d1 * d1 - 4.0 * d0 * d0 * d0).sqrt()) / 2.0);
163164
let significand_plus_one: f64 = -(CUBICALLY_INTERPOLATED_MAPPING_B + p + d0 / p)
164165
/ (3.0 * CUBICALLY_INTERPOLATED_MAPPING_A)
165166
+ 1.0;

0 commit comments

Comments
 (0)