Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Motion to finalise interval literals



On 6/8/2013 11:22 PM, John Pryce wrote:
> or - text2interval "shall" be provided, and *should* accept the
> stated syntax & semantics? If it doesn't, I suppose it accepts the
> host language's syntax & semantics of intervals. or some other
> variant?


I would hope that making text2interval optional  would also make it
easier to specify, and briefer in the standard.  I don't know what
people really expect or need.  Is double_text2interval("[decimal(0.1)]")
useful and better/clearer than text2interval("0.1") and how does that
compare with text2interval("1/10")?    I understand the desire to make
a simple formulation so that a single number notation like "0.1" in
decimal can be used to form an interval containing 1/10,  but I am
uncomfortable with it being the centerpiece of input for intervals.
Sorry I don't have an answer, though   round_outward_if_necessary("1/10")
works for me.

....
>
> Do you take issue with Sun Fortran? If I understand right, in real x
> interval xx x = 0.1       !machine approximation xx = [0.1]
> !enclosure of exact value the two 0.1's have "different meanings" in
> your sense. You don't like 0.1 changing its meaning when you put
> string quotes round it, so what about when you put square brackets
> round?
pages 20-21 of the Sun Fortran 95 Interval Reference indeed portrays
the input notation [0.1]  as rounding outward in creating an interval.
It creates something like [0,0.2]   whereas    [0.10]  creates [0.09, 0.11] etc.
(Since 0.2 is also not representable, something slightly different is produced).

 I think
this concept of uld (unit in the last digit) is an interesting design feature
trying to address the issue of concisely specifying intervals by text.
It might be useful for other implementations to use as an alternative
to  text2interval but need not be standardized either. 

I think the telling part of the Sun document is p 45 also p 48 where a distinction
is made between external and interval value for constants.  For a Fortran constant,
its interval and external value are the same. For an interval, there will
be a difference if the external value of the endpoints cannot be
represented exactly internally.  This means that Sun Fortran
must be able to (a) read 0.1 in the context [0.1] and (b) understand that
the interval with external value [0.1,0.1]  must have a different internal
value, rounded outward.  If I understand this language reference,
the result of
x=0.1
y=[x,x]
would create an interval with equal  internal and external values and
in fact would not contain the real number 1/10.

I am not clear as to what Sun Fortran would do if you did not use the
singleton input constant.   That is,  is [0.1,0.1]  as input, different from [0.1]?

My feeling is that it is OK for Sun Fortran to do all this, but it is not
appealing for a standard to specify. It takes too many pages for a start.
 Maybe it could be suggested as an additional approach  through a reference
to Sun or some other document as
double_text2interval_single_value_ULD_rounding("0.10")

I think text2interval eventually boils down to trying to
solve "How to read and represent an exact decimal number (e.g. 0.1) when it cannot be represented in binary."
and also trying to solve
"How to read and represent a rational number (e.g.1/3) when it cannot even be written in decimal."

If these questions can be answered without mentioning intervals,
maybe a cleaner solution will emerge.  (e.g. Lisp uses ratios of arbitrary
precision integers. Perhaps 2 floats works too.  Like 1/3 =  <1.0d0, 3.0d0>).
Consequently, define a structure and a few operations for "ratio". Then

x= interval(ratio(1,10), ratio(1,3))   etc

RJF