Added the function toStringWithPrecision.