Changing the computation to be split in 2 steps (one for each matrix) fixes the issue. However, it seems this function is used in a lot of places which I am not sure if this has the potential to slow down some other operations. So I will simply add a precise version of the function for now. Pull Request: https://projects.blender.org/blender/blender/pulls/141327