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

5
LINES

< > BotCompany Repo | #2000510 // formatDouble

New Tinybrain snippet [tags: archive]

  public static String formatDouble(double d, int digits) {
    String format = "0.";
    for (int i = 0; i < digits; i++) format += "#";
    return new java.text.DecimalFormat(format, new java.text.DecimalFormatSymbols(Locale.ENGLISH)).format(d);
  }

download  show line numbers   

Snippet is not live.

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

No comments. add comment

Snippet ID: #2000510
Snippet name: formatDouble
Eternal ID of this version: #2000510/1
Text MD5: 04683d1e74165eae6118df512c5eeb9e
Author: stefan
Category: javax
Type: New Tinybrain snippet
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-10 13:40:52
Source code size: 257 bytes / 5 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 663 / 776
Referenced in: #1002427 - Accellerating 629 (SPIKE)
#1007643 - formatDouble
#2000586 - formatInt - format an int with fixed number of digits
#3000382 - Answer for ferdie (>> t = 1, f = 0)