I am trying to get billion and million values from Abacus game , on iphone 5s and on iphone 6 its give me values correctly ,but on iphone 4s and on iphone 5 its give me values in minus format , i was try out with data type long long , long but still not give me correct value here is my code which works fine on iphone 5s and 6 but give warning and give number in minus format ,can anyone help me in this please here is image of my code
NSString *digitLabelText;
if([self digit] == 0)
{
digitLabelText= [NSString stringWithFormat:@"%ld", (long)[self digit]];
}
else
{
if([self placeValue] == ONE || [self placeValue] == TEN ||
[self placeValue] == ONE_HUNDRED || [self placeValue] == ONE_THOUSAND)
{
digitLabelText= [NSString stringWithFormat:@"%ld", (long)[self digit]];
}
else if([self placeValue] == TEN_THOUSAND)
{
digitLabelText= [NSString stringWithFormat:@"%ld,000",(long)[self digit]/ONE_THOUSAND];
}
else if([self placeValue] == HUNDRED_THOUSAND)
{
digitLabelText= [NSString stringWithFormat:@"%ld,000", (long)[self digit]/ONE_THOUSAND];
}
else if([self placeValue] == ONE_MILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld mil", (long)[self digit]/ONE_MILLION];
}
else if([self placeValue] == TEN_MILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld mil", (long)[self digit]/ONE_MILLION];
}
else if([self placeValue] == HUNDRED_MILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld mil", (long)[self digit]/ONE_MILLION];
}
else if([self placeValue] == ONE_BILLION)
{
//issue come from this in iphone 4s ,5 digitLabelText= [NSString stringWithFormat:@"%ld bil", (long)[self digit]/ONE_BILLION];
}
else if([self placeValue] == TEN_BILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld bil", (long)[self digit]/ONE_BILLION];///ONE_BILLION];
}
else if([self placeValue] == HUNDRED_BILLION)
{
digitLabelText= [NSString stringWithFormat:@"%ld bil", (long)[self digit]/ONE_BILLION];///ONE_BILLION];
}
else if([self placeValue] == ONE_TRILLION)
{
digitLabelText= [NSString stringWithFormat:@"%lld tril", (long)[self digit]/ONE_TRILLION];///ONE_TRILLION];
}
}
digitLabel.text = digitLabelText;
see my code please https://i.stack.imgur.com/U24oA.png