Ho il seguente codice:Objective-C stringvalue dalla doppia
double d1 = 12.123456789;
NSString *test1 = [NSString stringWithFormat:@"%f", d1]; // string is: 12.123457
NSString *test1 = [NSString stringWithFormat:@"%g", d1]; // string is: 12.1235
Come faccio ad avere un valore di stringa che è esattamente lo stesso di d1?
'% d' è un numero intero – PengOne
@PengOne L'ho corretto per lui, convertito in'% lf', lungo punto mobile. –
@ RichardJ.RossIII La mia comprensione è che '% lf' è necessario solo quando' scan'ing. – PengOne