NSNumericSearch does not behave according to documentation

Originator:leonvtippelskirch
Number:rdar://12005194 Date Originated:
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
 
01-Aug-2012 01:35 PM Leon von Tippelskirch:
Summary:
[smallString compare:longString options:NSNumericSearch] does not behave according to the documentation.

Steps to Reproduce:
Execute this code:

    NSString *shortString = [NSString stringWithFormat:@"%.0f", 1.0f];

    for (int i = 1; i < 30; i++)
    {
        NSString *longString = [NSString stringWithFormat:@"%.0f", powf(10, i) * 2.0f];

        NSLog(@"%@ < %@ =  %i ", shortString, longString, [shortString compare:longString options:NSNumericSearch]);
    }



Expected Results:
Log output:
1 < 200000005075528580230807552 =  -1 

Actual Results:
Log output
1 < 200000005075528580230807552 =  1 
OR
an update in the documentation that this behaves different on longer Strings.

Notes:
I attached a small demo project

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!