The general rule for rounding '5' my company uses is to round to the closest even number.
ie 99.5 = 100 or 98.5 = 98
2.405 = 2.40 or 1.395 = 1.40
It appears that gINT always rounds '5' up.
The only formulas I have been able to find even round all numbers up or all numbers down.
Is there a way to round 1 to 4 always down, 6 to 9 always up, but 5 to the closest even number?
Have you experimented with both the Format and RoundTo functions in gINT?
This issue comes up now and then, and always when the last digit is '5'. Here are some examples:
RoundTo Function output
55.5 formats to: <<Format(55.5,0)>>55.5 rounds to (1): <<RoundTo(55.5,1)>>55.5 rounds to (1+): <<RoundTo(55.5,1,+)>>55.5 rounds to (1-): <<RoundTo(55.5,1,-)>>54.5 formats to: <<Format(54.5,0)>>54.5 rounds to (1): <<RoundTo(54.5,1)>>54.5 rounds to (1+): <<RoundTo(54.5,1,+)>>54.5 rounds to (1-): <<RoundTo(54.5,1,-)>>
You can further control output by using the MOD Operator:
Basic expression
<<IIf(_ <<Calc(<<Int(55.5)>> MOD 2)>> = 0,_ <<RoundTo(55.5,1,-)>>,_ <<RoundTo(55.5,1,+)>>_)>>
Expression rewritten:
55.5 rounds to:
<<Let(Value = 55.5)>>_<<IIf(_ <<Calc(<<Int(<<Get(Value)>>)>> MOD 2)>> = 0,_ <<RoundTo(<<Get(Value)>>,1,-)>>,_ <<RoundTo(<<Get(Value)>>,1,+)>>_)>>
54.5 rounds to:
<<Let(Value = 54.5)>>_<<IIf(_ <<Calc(<<Int(<<Get(Value)>>)>> MOD 2)>> = 0,_ <<RoundTo(<<Get(Value)>>,1,-)>>,_ <<RoundTo(<<Get(Value)>>,1,+)>>_)>>