From 4f14fd55f5afabdc59442f39e15d64c840f97ae8 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Fri, 14 May 2021 19:21:28 +0800 Subject: [PATCH] Small code refinements. --- src/ast.rs | 12 ++++++++---- src/packages/math_basic.rs | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index 060875ca..ca0a0c83 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -2120,10 +2120,14 @@ mod tests { assert_eq!(size_of::>(), 16); assert_eq!(size_of::(), 32); assert_eq!(size_of::>(), 32); - #[cfg(not(feature = "no_smartstring"))] - assert_eq!(size_of::(), 96); - #[cfg(feature = "no_smartstring")] - assert_eq!(size_of::(), 80); + assert_eq!( + size_of::(), + if cfg!(feature = "no_smartstring") { + 80 + } else { + 96 + } + ); assert_eq!(size_of::(), 288); assert_eq!(size_of::(), 56); assert_eq!( diff --git a/src/packages/math_basic.rs b/src/packages/math_basic.rs index 9301ea46..e4d8b0b4 100644 --- a/src/packages/math_basic.rs +++ b/src/packages/math_basic.rs @@ -321,7 +321,7 @@ mod decimal_functions { #[rhai_fn(return_raw)] pub fn exp(x: Decimal) -> Result> { if cfg!(not(feature = "unchecked")) { - if x > Decimal::from_parts(10, 0, 0, false, 0) { + if x > Decimal::from_parts(117578, 0, 0, false, 4) { Err(make_err(format!("Exponential overflow: e ** {}", x,))) } else { Ok(x.exp())