Constructor query
John Pryce wrote:
> nums2interval(REAL l, REAL u) constructs [l,u] if l <= u.
That's assuming REAL matches the implementation type of intervals.
In general, "l" would be rounded down and "u" would be rounded up.
This becomes relevant for num2interval(REAL x) where the result
might not be a singleton.
The other thorny issue is what to do when either l or u is non-finite,
i.e. Inf or NaN. Ok, the constraint "l <= u" rules out Inf of the
wrong sign (as well as NaN, since it is not comparable), so the only
additional specification that is needed is when l = u = Inf or when
l = u = -Inf.
I suppose it should also be stated that when exactly one bound is
infinite, a semibounded interval is constructed, and when both bounds
are infinite (of the appropriate signs), Entire is constructed.
Finally, unless the language supports a *proper* Translation-Time Datum
Type (TTDT), appropriate warnings are needed when these constructors
are used with literals that do not correspond to exact floating-point
numbers, such as 0.1 for binary formats: nums2interval(0.1, 0.2) does
not contain the value 1/10 (but does contain 2/10). (Programmers have
to be reminded to use text2interval("0.1", "0.2") instead.)
Michel.
---Sent: 2010-02-09 20:07:42 UTC