Hi there
i have a string something like “3.1600559280405984” which is a latitude value. When i want to convert this into a float value, to assign to an annotation/coordinate, the floatValue of the string returns truncated 3.160056, how can i get the complete float without losing the decimals?
Or is there some other way i could assign strings to coordinates?
Thanks
The
floathas more precision than that. It’s just being displayed with fewer decimal points.You could use
printfor an Objective-C equivalent to print it with more decimal points. Note that some of those may be false precision, due to binary floating point issues.You can use
doublefor a bit more precision.Also, note that your input probably has false precision to begin with.