X# round() behaviour

This forum is meant for questions and discussions about the X# language and tools
Terry
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

X# round() behaviour

Post by Terry »

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
Post Reply