✅ Phase 1 Complete: FloatBox full implementation with operators and methods
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
@ -122,6 +122,12 @@ impl OperatorResolver {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(float_box) = left.as_any().downcast_ref::<crate::boxes::math_box::FloatBox>() {
|
||||
if let Some(result) = float_box.try_add(right) {
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(bool_box) = left.as_any().downcast_ref::<crate::box_trait::BoolBox>() {
|
||||
if let Some(result) = bool_box.try_add(right) {
|
||||
return Ok(result);
|
||||
@ -148,6 +154,12 @@ impl OperatorResolver {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(float_box) = left.as_any().downcast_ref::<crate::boxes::math_box::FloatBox>() {
|
||||
if let Some(result) = float_box.try_sub(right) {
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(bool_box) = left.as_any().downcast_ref::<crate::box_trait::BoolBox>() {
|
||||
if let Some(result) = bool_box.try_sub(right) {
|
||||
return Ok(result);
|
||||
@ -179,6 +191,12 @@ impl OperatorResolver {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(float_box) = left.as_any().downcast_ref::<crate::boxes::math_box::FloatBox>() {
|
||||
if let Some(result) = float_box.try_mul(right) {
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(bool_box) = left.as_any().downcast_ref::<crate::box_trait::BoolBox>() {
|
||||
if let Some(result) = bool_box.try_mul(right) {
|
||||
return Ok(result);
|
||||
@ -207,6 +225,15 @@ impl OperatorResolver {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(float_box) = left.as_any().downcast_ref::<crate::boxes::math_box::FloatBox>() {
|
||||
if let Some(result) = float_box.try_div(right) {
|
||||
return Ok(result);
|
||||
} else {
|
||||
// If try_div returns None, it might be division by zero
|
||||
return Err(OperatorError::DivisionByZero);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(bool_box) = left.as_any().downcast_ref::<crate::box_trait::BoolBox>() {
|
||||
if let Some(result) = bool_box.try_div(right) {
|
||||
return Ok(result);
|
||||
|
||||
Reference in New Issue
Block a user