Skip to content

Commit

Permalink
fix(cmn): 🐛 resolve error: float has excessive precision
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed May 9, 2024
1 parent e72b3da commit f63ff26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ pub const AVOGADRO: f64 = 6.02214076e23;
pub const BOLTZMANN: f64 = 1.380648e-23;

/// Catalan's constant, which is the sum of the alternating harmonic series.
/// C ≈ 0.9159655942
pub const CATALAN: f64 = 0.9159655941772190;
/// C ≈ 0.915965594177219
pub const CATALAN: f64 = 0.915_965_594_177_219;

/// Coulomb's constant, which is the proportionality constant in Coulomb's law.
/// k_e ≈ 8.9875517923 x 10^9 N m^2 C^-2
Expand Down Expand Up @@ -388,8 +388,8 @@ pub const SQRT2: f64 = std::f64::consts::SQRT_2;
pub const SQRT3: f64 = 1.7320508075688772;

/// The square root of 5.
/// √5 ≈ 2.2360679774997896964091736687313
pub const SQRT5: f64 = 2.2360679774997896;
/// √5 ≈ 2.23606797749979
pub const SQRT5: f64 = 2.236_067_977_499_79;

/// The circle constant, which is the ratio of a circle's circumference to its radius.
/// τ = 2π ≈ 6.28318530717958647692528676655900577
Expand Down
4 changes: 2 additions & 2 deletions tests/test_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ mod tests {
"BOLTZMANN should have a specific value"
);
assert_eq!(
CATALAN, 0.9159655941772190,
CATALAN, 0.915_965_594_177_219,
"CATALAN should have a specific value"
);
assert_eq!(
Expand Down Expand Up @@ -182,7 +182,7 @@ mod tests {
"SQRT3 should have a specific value"
);
assert_eq!(
SQRT5, 2.2360679774997896,
SQRT5, 2.236_067_977_499_79,
"SQRT5 should have a specific value"
);
assert_eq!(TAU, 2.0 * PI, "TAU should have a specific value");
Expand Down

0 comments on commit f63ff26

Please sign in to comment.