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

6
LINES

< > BotCompany Repo | #1031102 // formatDouble_roundUp

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

Libraryless. Click here for Pure Java version (81L/1K).

sS formatDouble_roundUp(double d, int digits) {
  S format = digits <= 0 ? "0" : "0." + rep(digits, '#');
  java.text.DecimalFormat df = decimalFormatEnglish(format);
  df.setRoundingMode(RoundingMode.UP);
  ret df.format(d);
}

Author comment

Began life as a copy of #1007643

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031102
Snippet name: formatDouble_roundUp
Eternal ID of this version: #1031102/1
Text MD5: fe952b4287ba28b9aa0e9723955f027e
Transpilation MD5: e9b12a9d1c672922014b188d1e50f5eb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-02 02:20:03
Source code size: 234 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 257
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)