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

Re: Let's gather some evidence!



Arnold Neumaier schrieb:
John Pryce wrote:

- How do you envisage "returning more information besides an interval" being implemented? If it is by the mechanism of an extra output argument, so c = a + b becomes c = plus(a,b,flag) as I believe is the scheme in the draft C++ interval standard, how should one remedy the huge inconvenience to the user, who has to rewrite existing function code?


With two datatypes, one for decorated and one for undecorated
intervals, this is easy.

Expressions like x=a+b can still be interpreted as before - if a,b are
undecorated intervals, the result will be undecorated, if they are
decorated intervals the result will be decorated.

Alternatively, one could use compiler directives that tell how a given
block of code is to be treated, the default being using no decorations.

Automatic detection of what is needed is also a possibility.


Arnold Neumaier


In C++ this is easy,

I have written a test-implementation with the two datatypes
Interval and ExpressionResult (a flagged interval).

With an overloaded assignment-operator it is easy and comfortable.
You don't need any expression like c = plus(a,b,flag). You can simply write

Interval a = ...
Interval b = ...

ExpressionResult c = a + b;

if (c.getFlag())
	Interval i = c;

But it is also possible to write

Interval c = a + b;

without flags.

--
     o           Marco Nehmeier, Lehrstuhl fuer Informatik II
    / \          Universitaet Wuerzburg, Am Hubland, D-97074 Wuerzburg
InfoII o         Tel.: +49 931 / 31 88684
  / \  Uni       E-Mail: nehmeier@xxxxxxxxxxxxxxxxxxxxxxxxxxx
 o   o Wuerzburg