gibbsly / gm

A utility datapack for doing math operations
The Unlicense
33 stars 2 forks source link

Add rounding functions + small fixes #9

Closed GlitchlessCode closed 8 months ago

GlitchlessCode commented 8 months ago

The Suggestion

Add the following functions:

gibbsly commented 8 months ago

looks good to me, interesting ceil implementation

GlitchlessCode commented 8 months ago

Yeah, the ceil was kinda bizarre, cause the only form of rounding (at least that I'm aware of) that is built in to MC is flooring. So, floor(x) is just floor(x), and round(x) is floor(x+0.5), but ceil(x) has to be -floor(-x)

gibbsly commented 8 months ago

yea I know of a floating point hack round but no ceiling, the only thing I can think of is doing like floor(x+(1-min_double)) but even then i'm not sure