pissang commented on a change in pull request #16286:
URL: https://github.com/apache/echarts/pull/16286#discussion_r775786860



##########
File path: src/util/number.ts
##########
@@ -138,7 +138,9 @@ export function round(x: number | string, precision: 
number, returnStr: false):
 export function round(x: number | string, precision: number, returnStr: true): 
string;
 export function round(x: number | string, precision?: number, returnStr?: 
boolean): string | number {
     if (precision == null) {
-        precision = 10;
+        // auto adjust round precision by decimal place length only when the 
number is using scientific
+        const exp = String(x).split('e')[1];

Review comment:
       It's not the precision `x`. `1.3e-10` will have exp 10 here. But it 
should be 11. 
   Also we prefer x + '' to convert a value to string. And `-exp` already 
convert it to a number.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to