diff options
author | Dominick Allen <dominick.allen1989@gmail.com> | 2020-06-28 19:50:35 -0500 |
---|---|---|
committer | Dominick Allen <dominick.allen1989@gmail.com> | 2020-06-28 19:50:35 -0500 |
commit | 2ffb5357e0e35d415311a40eea14e9cc99dd54ab (patch) | |
tree | 0410800cd74956d294a76ef6e47d527b0c1adeed /src/lib/eval | |
parent | 3eb53c36123c4a8a8f336c255a9d5a7b44ca922c (diff) |
Improve read functionality.
Diffstat (limited to 'src/lib/eval')
-rw-r--r-- | src/lib/eval/arith.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/eval/arith.rs b/src/lib/eval/arith.rs index fe3a06b..d7d53e0 100644 --- a/src/lib/eval/arith.rs +++ b/src/lib/eval/arith.rs @@ -1,10 +1,11 @@ use std::ops::{Add, Sub, Mul, Div}; use super::super::types::Type; +use super::super::types::FloatType; use super::super::types::Number; fn apply_arithmetic( func_i: fn(isize, isize) -> isize, - func_f: fn(f32, f32) -> f32, + func_f: fn(FloatType, FloatType) -> FloatType, operand_a: &Type, operand_b: &Type) -> Result<Type, String> { @@ -17,7 +18,7 @@ fn apply_arithmetic( (Type::Number(Number::Int(i)), Type::Number(Number::Float(f))) | (Type::Number(Number::Float(f)), Type::Number(Number::Int(i))) => { - Ok(Type::Number(Number::Float(func_f(*f, *i as f32)))) + Ok(Type::Number(Number::Float(func_f(*f, *i as FloatType)))) }, (Type::Number(Number::Int(a)), Type::Number(Number::Int(b))) => { |