Vector2d.ToString() - Why limit to 5 decimals when geocodes can be 6?
I just noticed something we've now changed internally, as it provided a bit of some confusion for some time, as we were printing Vector2d to Debug.Log, and thought we got wrong latitude/longitude.
We have now changed the code to
public override string ToString()
{
return string.Format(NumberFormatInfo.InvariantInfo, "{0:F6},{1:F6}", this.y, this.x);
}
Any reason for the 5 decimals limit instead of 6?
@Alexphauge ah nice catch, sorry about that. I can't think of any reason really, it was probably just a mistake. ToString is always risky for debugging though, as you may not notice if ToString method is overriden etc. if you haven't particularly checked it. Lost me so much time before as well. If I remember correctly, Unity still uses F1 for float ToString for example. But maybe it's a little safer as it looks wrong right away.
No worries, it only wasted about 10 minutes trying to figure out what was going on. :)