Faced with the problem of variables.

Started by Danil2000707 on Sun, 02/07/2021 - 15:34

Topic category: Help with modding (Java Edition)

Last seen on 17:24, 9. Apr 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Faced with the problem of variables.
Sun, 02/07/2021 - 15:34

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.

Last seen on 17:24, 9. Apr 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Okay I get it
Sun, 02/07/2021 - 16:43

Okay I get it

Last seen on 17:24, 9. Apr 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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?