TSa wrote:
> just re-reading S03 I saw that it defines the Rat to Int
> conversion as truncation. Why not floor semantics like in %?
> Actually I would recommend floor semantics whenever an integer
> is coerced. With the sole exception of Num propably using
> rounding.

If the difference matters to people, I suggest just having available a range of explicit rounding methods to choose from, though not necessarily as separate operators, but rather as an enumerated type you can supply as an additional argument (or trait?) to a routine that would do rounding, to coerce the desired semantics.

In my Muldis D language, I have so far these 7 rounding methods as values of a particular enumerated type: half_down|half_up|half_even|to_floor|to_ceiling|to_zero|to_inf, for use as an extra argument. To give you an idea of what I refer to. These can also apply to any situation of simply rounding to lesser precision, not necessarily just to integers.

Or maybe your question is more about what method to use by default if users don't explicitly choose one?

-- Darren Duncan

Reply via email to