It seems that echo $image->dimensions()->ratio() displays the ratio number formated on locale format, so in french it outputs 1,5 and not 1.5 which is an issue when you want to make calculations or use it in inline styles.
I don’t know if it’s only because of the locale or if smartypants is involved, but I don’t chain it with kt() or any modifiers.
It was for css calculations, so I tought had to echo it first but I can do the calculation beforehand. I need to echo it in css after the calculation so I will use number_format. Thank you.