I have a float number that I would like to display in a string way.
E.g.
0.33 should be displayed as 1/3
0.5 should be displayed as 1/2
How can I do it in objective-c with no switch? (as I could have 3/4, 2/5 etc)
I have a float number that I would like to display in a string way.
E.g.
0.33 should be displayed as 1/3
0.5 should be displayed as 1/2
How can I do it in objective-c with no switch? (as I could have 3/4, 2/5 etc)
There's no objective-c way to do this, you'll have to implemente it yourself and find an algorightm.
What about trying combinations of A/B where A,B from 0 to 10, until you reach the number?