mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-01-19 03:38:13 +01:00
Don't allow multiplication of vectors of different sizes
This commit is contained in:
parent
3c6f38c28a
commit
443a1876fb
@ -696,6 +696,10 @@ impl KalkValue {
|
||||
.collect(),
|
||||
),
|
||||
(KalkValue::Vector(values), KalkValue::Vector(values_rhs)) => {
|
||||
if values.len() != values_rhs.len() {
|
||||
return KalkValue::nan();
|
||||
}
|
||||
|
||||
let mut sum = KalkValue::from(0f64);
|
||||
for (value, value_rhs) in values.iter().zip(values_rhs) {
|
||||
sum = sum.add_without_unit(&value.clone().mul_without_unit(value_rhs));
|
||||
|
Loading…
Reference in New Issue
Block a user