PREC constant
authored by electria
This commit is contained in:
parent
98413eb1b7
commit
e27438a244
1 changed files with 6 additions and 4 deletions
10
src/parse.rs
10
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<Vec<Node>, 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<Vec<Node>, 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))
|
||||
],
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue