4
 Followers
17
 Likes

Math.Round add optional parameter

Builtin & User functions
New

Looking at:

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Math#Round

means that when you round in the code versus round in an aggregate you can have different output.

This is horrible to work with.

Therefor I suggest to add a optional parameter to Round to provide how you want to round, so we can make the aggregate and code consistent without having to build some weird workarounds.



Created on 18 Mar
Comments (7)

The outsystems round seems to be weird in it's own!
Take a look:

Round(2.5) = 2
Round(3.5) = 4

I mean, how can this be reliable if 3.5 returns 4 and 2.5 returns 2?

In any other case MySQL / IDB2 is the odd one, rounding -5.5 to -5
Looking at how ROUND(ABS(-5.5)) returns 6, and ABS(ROUND(-5.5)) returns 5.

I would prefer to use trunc instead so it does what I expect it to do.

Agreed, this needs to be fixed.

Joey,


It's not that weird, because the language (c#) uses the round to nearest even integer.

(also known as banker's rounding, dutch invention afaik )

so both types of roundings are valid, but I would love to see it to be consistent.



"In any other case MySQL / IDB2 is the odd one, rounding -5.5 to -5
Looking at how ROUND(ABS(-5.5)) returns 6, and ABS(ROUND(-5.5)) returns 5."

ABS converts -5.5 into 5.5, rounding to the next integer 6. Rounding -5.5 returns to the next integer, which is -5. -6 is smaller than -5.5 and smaller than -5.

I've built an extension to overcome these types of scenarios. I'll publish it later.

Merged this idea with 'Round function should allow to select round method' (created on 16 May 2019 20:18:58 by mariap)

It would be really useful if we were able to select the rounding method to away from 0.



This comment was:
- originally posted on idea 'Round function should allow to select round method' (created on 16 May 2019 by mariap)
- merged to idea 'Math.Round add optional parameter' on 11 Jun 2019 18:50:09 by Tiago Leão

Changed the category to Builtin & User functions




This comment was:
- originally posted on idea 'Round function should allow to select round method' (created on 16 May 2019 by mariap)
- merged to idea 'Math.Round add optional parameter' on 11 Jun 2019 18:50:09 by Tiago Leão

Mayday, mayday!!!

In urgent need of an optional parameter on Round(...) function 

C# has it since its early days: https://docs.microsoft.com/en-us/dotnet/api/system.math.round?view=netframework-4.8#Round4_Example

views
209
Followers
4