title: How to calculate Android screen aspect ratio mathematically
body: <p>One of the device screen properties that Android lets an app query is it's aspect ratio. In the examples that I have seen this property seems to have only two values - <strong><em>long</em></strong> and <strong><em>notlong</em></strong>.</p>
  
  <p>I am trying to reverse engineer the logic being used by Android to classify a device as having one of the two aspect ratios.</p>
  
  <p>To get some official data to work with, I referred to the values provided by the device definitions included in the AVD Manager tool in Android Studio, and combined that with my own calculations:
  <img src="https://i.stack.imgur.com/nGfmz.png" alt="Devices included in AVD Manager"></p>
  
  <p>The column "Published Ratio" shows the value extracted from the AVD Manager. Based on these results, I am failing to understand how Nexus 5 and 6 are considered <strong><em>notlong</em></strong> while Galaxy S4 and Galaxy Nexus are considered <strong><em>long</em></strong>.</p>