I noticed that removing the assert_eq!() in the basics.rs example on line 80 caused the printed values to change.
Not sure if this is intended, but it doesn't seem like it. I'm quite new to Rust so maybe I missed something, but I am unable to explain why this happens.
This is the part of the code in basic.rs I mean
for idx in 0..WORK_SIZE {
if idx < RESULTS_TO_PRINT {
println!("source[{idx}]: {:.03}, \t coeff: {}, \tresult[{idx}]: {}",
vec_source[idx], COEFF, results[idx], idx = idx);
}
assert_eq!(vec_source[idx] * COEFF, vec_result[idx]);
}
If I change it to this, the printed values change
for idx in 0..WORK_SIZE {
if idx < RESULTS_TO_PRINT {
println!("source[{idx}]: {:.03}, \t coeff: {}, \tresult[{idx}]: {}",
vec_source[idx], COEFF, results[idx], idx = idx);
}
}
However, if I change it to this it doesn't change
for idx in 0..WORK_SIZE {
if idx < RESULTS_TO_PRINT {
println!("source[{idx}]: {:.03}, \t coeff: {}, \tresult[{idx}]: {}",
vec_source[idx], COEFF, results[idx], idx = idx);
}
let test = vec_source[0] * COEFF;
}
I noticed that removing the assert_eq!() in the basics.rs example on line 80 caused the printed values to change. Not sure if this is intended, but it doesn't seem like it. I'm quite new to Rust so maybe I missed something, but I am unable to explain why this happens.
This is the part of the code in basic.rs I mean
If I change it to this, the printed values change
However, if I change it to this it doesn't change
Normal printed values:
Altered printed values:
The line of code I'm talking about:
https://github.com/cogciprocate/ocl/blob/f495254064da566de1195a02ef399f6f2a054c11/ocl/examples/basics.rs#L80