Faced with the problem of variables.

Started by Danil2000707 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Faced with the problem of variables.

Faced with the problem of variables. Here I have a variable and at a certain action it increases by 0.1. This procedure is repeated several times and the variable becomes 0.300000004. Is there any way to fix this? To always have the correct number

This is due to Java rounding…
Sun, 02/07/2021 - 16:36

This is due to Java rounding. If you want exact numbers, use integers (1, 2, 3, -4, ...) and avoid any decimal numbers and operations.

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Are there any procedures to…
Sun, 02/07/2021 - 17:41

Are there any procedures to round numbers to 0.1 or 0.2?