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

15
LINES

< > BotCompany Repo | #1007643 - formatDouble

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (96L) is out of date.

sS formatDouble(double d, int digits) {
  S format = digits <= 0 ? "0" : "0." + rep(digits, '#');
  ret decimalFormatEnglish(format, d);
}

sS formatDouble(double d) {
  ret str(d);
}

ifclass DoubleRange
sS formatDouble(DoubleRange r, int digits) {
  ret r == null ? "null" : "[" + formatDouble(r.start, digits)
    + ";" + formatDouble(r.end, digits) + "]";
}
endif

Author comment

Began life as a copy of #2000510

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007643
Snippet name: formatDouble
Eternal ID of this version: #1007643/7
Text MD5: 6a8a7cb5fa5c6d9872c0ef9550993616
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-17 23:04:04
Source code size: 381 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 437 / 558
Version history: 6 change(s)
Referenced in: [show references]