This is how I understand the specification.
First you need the value of the “unit” field:
0: no unit, just pixel ratio
1: dpi
2: dots per cm
When the unit is 0, you have just to divide the two values to get the aspect ratio. No density given. Otherwise, you get an X and Y density (e.g. for print) and can also derive the aspect ratio from that.