diff --git a/src/parse.rs b/src/parse.rs index dd75844..530bd6f 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -13,6 +13,8 @@ enum Error { NumberParsing(String, ParseFloatError), } +const PREC: u32 = 512; + #[derive(Clone, Debug, PartialEq)] enum Node { Function(Function), @@ -96,7 +98,7 @@ fn nodes_from_str(s: &str) -> Result, Error> { .map_err(|e| { Error::NumberParsing(filtered_string[start_index..i].to_owned(), e) })? - .complete(512), + .complete(PREC), )); state = ParsingState::Start; @@ -138,7 +140,7 @@ fn nodes_from_str(s: &str) -> Result, Error> { .map_err(|e| { Error::NumberParsing(filtered_string[start_index..i].to_owned(), e) })? - .complete(512), + .complete(PREC), )); } } @@ -153,10 +155,10 @@ fn test_nodes_from_str() { &[ Node::Function(Function::Sine), Node::ParenthesisStart, - Node::Number(Float::with_val(512, 2)), + Node::Number(Float::with_val(PREC, 2)), Node::ParenthesisEnd, Node::Operator(Operator::Plus), - Node::Number(Float::with_val(512, 1)) + Node::Number(Float::with_val(PREC, 1)) ], ) }