Eigenvalues of matrices with rational entries


When I compute the eigenvalues of an Array{Rational{Int64},2}, I get Float32 values.

  julia> eigvals([1//2   1//4   1//4  
                  1//2    0    1//2  
                  1//4   1//4   1//2])
  3-element Array{Float32,1}:

Why not Float64 values?


Good catch, I think this is a bug. Looks like it was introduced a long time ago, as a consequence of #5526 (which added Float32 to the promotion to make things work for Float16) and #5652 (which changed the promotion criteria to use norm) and then a later change to the norm function that made norm(::Rational) return a Rational.

I filed an issue: https://github.com/JuliaLang/julia/issues/24935