Skip to content

Conversation

@dannyvankooten
Copy link

Closes #68

Comment on lines +247 to +250
while let Some(next) = chars.peek() {
if !matches!(*next, '0'..='9') {
break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can use .next_if instead.


if num_vec.len() > 0 {
if let Some(exp) = num_vec.parse::<usize>().ok() {
result.push(Token::Num(x * pow(10 as f64, exp) as f64));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't using num::pow directly be better?

Suggested change
result.push(Token::Num(x * pow(10 as f64, exp) as f64));
result.push(Token::Num(x * num::pow(10 as f64, exp) as f64));

chars.next();
}

if num_vec.len() > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if num_vec.len() > 0 {
if !num_vec.is_empty() {

Comment on lines +290 to +294
#[test]
fn eval_exponential_notation_decimal() {
let evaled = eval("2.5e5", None);
assert_eq!(evaled, Ok(250000.0));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please try this too? 5e5e5.

@ameertaweel
Copy link

@dannyvankooten Any updates on this?

@pickfire
Copy link
Collaborator

@ameertaweel I think you can just create a PR to supersede this pull request, the author might be busy.

gbPagano added a commit to gbPagano/eva that referenced this pull request Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support for exponential notation

3 participants