Open faze-geek opened 4 months ago
I suspect this is a rounding issue in std::cout if you use the following line it displays correctly:
std::cout << std::fixed << std::setprecision(1) << arr1(0, 0);
This is not an xtensor issue. 1 or 1.0 are equal and that is the correct output.
I was not questioning the output, but with xtensor handling multiple dtypes getting 1.
on print would be ideal. Let's make sure that the example prints in the same way as well to avoid any confusions.
It's a small refactor, maybe I can send in my first PR ?
std::cout
to use setprecision.xt::view(arr, 0, 0)
for the indexing instead of arr(0, 0)
. This prints 1. as expected.
Kindly checkout the Index Access example from https://github.com/xtensor-stack/xtensor?tab=readme-ov-file#basic-usage .
Output
1.0 is expected which is correctly shown in the ReadMe output.
I have also run the example on binder jupyter notebook to avoid any discrepancy caused locally.