small optimization for the toFloat func, r=pgiraud (closes #2875)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10998 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -873,13 +873,11 @@ OpenLayers.Util.toFloat = function (number, precision) {
|
||||
if (precision == null) {
|
||||
precision = OpenLayers.Util.DEFAULT_PRECISION;
|
||||
}
|
||||
var number;
|
||||
if (precision == 0) {
|
||||
if (typeof number !== "number") {
|
||||
number = parseFloat(number);
|
||||
} else {
|
||||
number = parseFloat(parseFloat(number).toPrecision(precision));
|
||||
}
|
||||
return number;
|
||||
return precision === 0 ? number :
|
||||
parseFloat(number.toPrecision(precision));
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user