Reputation: 27295
I'm trying to figure out the best way to put complex numbers into my math-oriented iPhone app. I've found the mac osx manual page for complex numbers, which looks like a reasonable start. Three questions:
(1) Is this the best starting point?
(2) I will need an object-oriented wrapper -- can NSValue do this somehow? Or should I just write my own? (not difficult, but I'd rather use a built-in one if it exists).
(3) Is there a built-in way to get a string representation of a complex?
Upvotes: 1
Views: 809
Reputation: 7422
As far as I know, there's no built-in complex number support in Cocoa (other than the C libraries). It sounds like you have a good approach. I haven't looked at it carefully yet, but here's a cocoa calculator with source code that supports complex numbers--you might be able to get some ideas.
Upvotes: 1
Reputation: 2146
Upvotes: 1