How to allways round up

I have a decimal that I need to convert to an integer, but the decimal should allways be rounded up: 0.1 -> 1 0.2 ->1 .. 0.9 -> 1 1.01 > 2 1.1 > 2 .. 1.9 -> 2 2.1 -> 3 etc. What would be the best way to do this? I can't find it in the basic mathematics functionalities in Mendix and I'm not sure how to handle this situation
3 answers

You can use the ceil function: Mathematical function calls


The ceil() function should perform this rounding.

As Sebastiaan indicates, there is no way to do this automatically throughout your application. If this decimal is stored in an attribute, you could use a before commit event handler that changes the value of $Entity/Attribute to ceil($Entity/Attribute).


There is no option for this to handle it all automatically, the choices you have are to round numbers 'Half away from zero' or 'Half to the nearest even number' (also called bankers rounding)

Edit: For doing it manually, use the ceil function as others have mentioned.

Or file a feature request for more rounding modes.