title: NSNumber and float - type casting oddity
body: <p>In my application I am using an external API which communicates using json. Today  I encountered strange (it may be strange just due to my inexperience in iOS) behavior between floats and NSNumbers. The thing is that I am receiving a float in APIs response, in this particular case it is 135.99. When native obj-c json parser parse the response it creates NSNumber with that value. It works perfect. But at when I started using this API I didn't know  how native json parser bahaves, so I've been doing something like this:</p>
  
  <pre><code>NSNumber * number = [NSNumber numberWithFloat:[[response objectForKey:@"Number"] floatValue]];
  </code></pre>
  
  <p>So, what is happening above is actually casting NSNumber to float and creating new NSNumber with that float. And what is so strange about it? Strange (for me) is that above line generates NSNumber with value... 135.99001 instead of 135.99 which is the proper one. </p>
  
  <p>I know that float arithmetics is really messed up, especially in languages like PHP (0.2 + 0.7 not equals 0.9), but I haven't expected that in languages like objective-c, which is a superset od C language, I would find such mess to. Does anyone has a good explanation to that issue? </p>