Thanks for the information above. I have tried a new way to calculate it BUT in a real Pixel6 device, not an emulator.
val xdpi = displayMetrics.xdpi -> 409.432
val ydpi = displayMetrics.ydpi -> 411.891
It is a value around 411
If I calculate the diagonalInches using this value instead of the density I get 6,4inches