-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Describe the bug
Currently, the type of the elements of a list or a matrix are based on the first element. However, some containers may have several different but compatible types (int and float). A non-aware user may mix them and get wrong results, and without being able to understand that it comes from different types being used. For example, consider those three lines:
write determinant(matrix([[1.0,0.0],[1.0,0.2]]));
write determinant(matrix([[1,0],[1,0.2]]));
write determinant(matrix([[1.0,0],[1,0.2]]));
the result obtained is
0.2
0.0
0.2
The first and third lines provide the good result. The second one provides a wrong result since all the elements are casted to the type of the first element, which is int. However, it is probably the most natural way to write the matrix, since people don't bother with the ".0" when not needed. What is more confusing is that when writing something like "float a <- 1", there is a warning telling that 1 will be casted to float, and here not, so there is no way for a common user to have a clue about a possible error in the result.
I label this as a bug, since a regular user would think that not having the correct result using a determinant is a bug.