Rounding to decimal places

Started by OllyWanted77 on

Topic category: Help with MCreator software

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Rounding to decimal places

is there any way I can round to 1 decimal place? I've been searching for a while and I cant find anything.

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It can be done with custom…
Thu, 10/12/2023 - 17:44

It can be done with custom code

 

DecimalFormat df = new DecimalFormet("#.#");
df.setRoundingMode(RoundingMode.HALF_UP);

YOURNUMBER = Double.parsDouble(df.format(YOURNUMBER));