Changeset 4046
- Timestamp:
- 08/27/07 04:52:12 (1 year ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/BaseTypes.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/BaseTypes.js
r3984 r4046 126 126 */ 127 127 Number.prototype.limitSigDigs = function(sig) { 128 var number = (sig > 0) ? this.toString() : 0; 129 if (sig < number.length) { 130 var exp = number.length - sig; 131 number = Math.round( this / Math.pow(10, exp)) * Math.pow(10, exp); 128 var numStr = (sig > 0) ? this.toString() : "0"; 129 if (numStr.contains(".")) { 130 var msg = "limitSigDig can not be called on a floating point number"; 131 OpenLayers.Console.error(msg); 132 return null; 132 133 } 133 return parseInt(number); 134 if ( (sig > 0) && (sig < numStr.length) ) { 135 var exp = numStr.length - sig; 136 numStr = Math.round( this / Math.pow(10, exp)) * Math.pow(10, exp); 137 } 138 return parseInt(numStr); 134 139 } 135 140
