I'm writing an application, but I'm having a problem getting an unexpected result.
One function returns an 11 character NSString, which I can easily convert to an int or float value. The number is in Hertz (Hz) for frequency. The problem is I want to express it in MegaHertz (MHz) so I divide it by 1000000 and then display this number in my interface in a NSTextField.
Sometimes when I display the number I get strange results, which I blame on a floating point error.
I start with 00118125500, convert it to a float of 118125500 and the divide by 1000000 and I sometimes get 118.125499. When I later try processing this number later in my application I get all sorts of problems.
Any ideas what I can do to elimate this problem.
Thanks