orderingValue's unexpected values


in the following code we compute the orderingValue ivar-

[code]-(BNRItem *)createItem{
double order;
if ([allItems count]==0) {
order= 1.0;
order= [[allItems lastObject] orderingValue] +1.0 ;
NSLog(@“Adding after %d items, order= %.2f”, [allItems count],order);
BNRItem *p= [NSEntityDescription insertNewObjectForEntityForName:@“BNRItem” inManagedObjectContext:context];

[p setOrderingValue:order];

[allItems addObject:p];
return p;

SO from the above code we have orderingValue=1+ IndexOfTheCurrentBNRItem
After this we compute the lower bounds and upper bounds in the following code -

[code]-(void)moveItemAtIndex:(int)from toIndex:(int)to{
if (from==to) {
NSLog(@“destination- %d”,to);
BNRItem *p= [allItems objectAtIndex:from];
[allItems removeObjectAtIndex:from];
[allItems insertObject:p atIndex:to];

//computing a new orderValue for the object that was moved..
double lowerBound=0.0;

NSLog(@"destination- %d",to);
//Is there an object before it in an array?
if (to>0) {
    lowerBound= [[allItems objectAtIndex:to-1] orderingValue];//One spot before the destination pt.
    NSLog(@"lowerbound- %f",lowerBound);
    lowerBound= [[allItems objectAtIndex:1] orderingValue]-2.0;
    NSLog(@"lowerbound2- %f, orderingValue- %f",lowerBound,[[allItems objectAtIndex:1] orderingValue]);

double upperBound= 0.0;

//Is there an object after it in the array?
if (to< [allItems count]-1) {
    upperBound= [[allItems objectAtIndex:to+1] orderingValue];
    upperBound= [[allItems objectAtIndex:to-1] orderingValue]+2.0;

double newOrderValue=(lowerBound+upperBound)/2.0;
NSLog(@"moving to order %f", newOrderValue);
[p setOrderingValue:newOrderValue];

Now when running the app in the simulator, i move the 0th cell to the 1st position (the 1st cell automatically moves up to the 0th position), that means “to=1”;
So the first if statement runs {(if(t>0)}, and lower bound should be 1, [[allItems objectAtIndex:1-1] orderingValue] i.e orderingValue at 0th index=1. That makes lower bound equal to 1; But the console shows different result–
2014-04-25 19:01:50.293 HomePwner8[1148:70b] destination- 1
2014-04-25 19:01:50.294 HomePwner8[1148:70b] lowerbound- 2.000000

from the above calculation the lower bound should be 1…then why is it coming 2 ??