X# round() behaviour
Posted: Tue Apr 23, 2019 8:16 am
Hi All
Round() on it's own will always be ambiguous. It must be either up or down. There must be a certain precision specified.
However that is implemented behind the scenes (binary or decimal) is not of real interest to developers.
What is important is to ensure developers can communicate their intentions precisely and unambiguously.
So, rather than having to rely on our own memory - does XSharp round up or down? did VO round up or down? - would it not be better to get rid of Round() and replace it with something like Round(up or down, decimal precision).
Keep Round() for compatibility with what has gone before, but gradually phase it out of XSharp.
I can envisage business situations in which rounding up or rounding down could make a difference between profit and loss.
Now, at this early stage of XSharp is surely the time to do such things.
Terry
Round() on it's own will always be ambiguous. It must be either up or down. There must be a certain precision specified.
However that is implemented behind the scenes (binary or decimal) is not of real interest to developers.
What is important is to ensure developers can communicate their intentions precisely and unambiguously.
So, rather than having to rely on our own memory - does XSharp round up or down? did VO round up or down? - would it not be better to get rid of Round() and replace it with something like Round(up or down, decimal precision).
Keep Round() for compatibility with what has gone before, but gradually phase it out of XSharp.
I can envisage business situations in which rounding up or rounding down could make a difference between profit and loss.
Now, at this early stage of XSharp is surely the time to do such things.
Terry