Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1018790 // formatDouble_significant2 - format with significant number of total digits

JavaX fragment (include)

static S formatDouble_significant2(double d, int digits) {
  try {
    digits -= Math.floor(max(-10, Math.log10(abs(d))+1));
    ret formatDouble(d, digits);
  } on fail {
    print("Had number: " + d + ", digits: " + digits);
  }
}

Author comment

Began life as a copy of #1010031

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018790
Snippet name: formatDouble_significant2 - format with significant number of total digits
Eternal ID of this version: #1018790/11
Text MD5: e5872f09514fe5ce7ef5911f418e1045
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-05 18:39:08
Source code size: 239 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 373 / 456
Version history: 10 change(s)
Referenced in: [show references]