When converting to "int" which is the rounding method used in Math Formula?

When converting to “int” which is the rounding method used in Math Formula? node?

Hi @PBJ , I’d have assumed it was “roundhalfup” which is what I would take to be “common rounding”, but I thought I’d better prove it.

In the image that follows, the converttoint column shows the effect of performing no action on the “myvalue” (Double) column other than to convert to int:
and is defined like this:

The other columns demonstrate the effects of roundHalfUp(n,0), roundHalfDown(n,0), round(n) and round(n,0)

The round() functions perform “roundHalfEven”, so rounds .5 in the direction of the nearest even integer.

This is the result of each math formula.

The above shows the direction of rounding (down the page is rounding up, and up the page is rounding down).

As you can see the convertoint matches the Round Half Up method.

4 Likes

Many Thanks. People can view the reactivity of the community.

Best regards.

Pascal

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.