You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/12/27 12:24:39 UTC

[GitHub] [echarts] songlinn commented on a change in pull request #16286: fix: change the precision of number to Number.toFixed max precision

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



##########
File path: src/util/number.ts
##########
@@ -138,7 +138,7 @@ 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;
+        precision = ROUND_SUPPORTED_PRECISION_MAX;

Review comment:
       What do you think auto calculate precision by number decimal place length?
   such as :
     if (precision == null) {
           const exp = String(x).split('e')[1];
           precision = Number(-exp) || 10;
       }`
   `




-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org