title: Do memory addresses follow a pattern in iOS?
body: <p>I'm comparing two NSNumbers in my app and I've done it the wrong way:</p>
  
  <pre><code>if(max &lt; selected)
  </code></pre>
  
  <p>And it should be:</p>
  
  <pre><code>if([max longValue] &lt; [selected longValue])
  </code></pre>
  
  <p>So the first comparison is really comparing the two object memory addresses, the funny thing (at least for me) is that the values seems to be related with the addresses. For example, if I get the first number with value <code>5</code> its memory address is <code>0xb000000000000053</code> and if I get the second with <code>10</code> is <code>0xb0000000000000a3</code> (being "a" equivalent to 10 in hexadecimal).</p>
  
  <p>For that reason the first comparison (wrong) was actually working. Now an user complaint about an error here and is obviously because of this but it has lead me to the next questions:</p>
  
  <p>Does this only happen in simulators? Cause it's where I'm testing, and the user will have a real device. Or maybe this happen normally but it's not a rule always fulfilled?</p>