From c74abdace3ec0b0f15397e64b89d59ccf983604f Mon Sep 17 00:00:00 2001 From: electria Date: Fri, 23 Oct 2026 22:18:05 -0700 Subject: [PATCH] fix: ignore underscore in input I accidentally removed this before... oops :3 --- src/formatting.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/formatting.rs b/src/formatting.rs index bb67376..b7b6a58 100644 --- a/src/formatting.rs +++ b/src/formatting.rs @@ -4,6 +4,7 @@ use crate::nodes::{self, Error}; pub fn pretty_eval(input: &str, max_digits: usize) -> Result { let (prefix, deliminator, input) = input.rsplit_once_last(&["= ", "& ", "plus.minus "]); + let input = input.replace('_', ""); // no need to remove the character here, // as we ignore it in all other logic already @@ -134,6 +135,11 @@ mod tests { assert_pretty_eval!("plus.minus 5 & = 5"); } + #[test] + fn underscore_input() { + assert_pretty_eval!("10_000 * 10_000 * 4", "4 * 10^8") + } + #[test] fn basic_get_significant_digits() { let many_zeros = eval("14.00643 + 1.00784 * 4 + 35.446 + 15.9994 * 4");