| Thread Links | Date Links | ||||
|---|---|---|---|---|---|
| Thread Prev | Thread Next | Thread Index | Date Prev | Date Next | Date Index |
Michel Hack>> Divp(xx, yy) =def Div(xx, (yy Intersect [0, +oo]))
Michel Hack>> Divn(xx, yy) =def Div(xx, (yy Intersect [-oo, 0]))
Arnold Neumaier> 1. In a program, division with gaps must always be called as a
Arnold Neumaier> function, whereas ordinary division (divideHull) will usually
Arnold Neumaier> be called by overloading.
An alternative that most programming language bindings can include is a divide function that returns a structure or array containing two intervals. Some languages could also include an overloaded divide operator that returns a pair of intervals.
With either, there needs to be a way to extract each of the two intervals. That could be by structure member (.negative and .positive), by array element ([0] and [1]), or both ways.
With either, one advantage is that the compiler doesn't need to find pairs of calls and optimize them into one.
If you want to handle both results the obvious way is to store the interval pair into a variable, then write code to handle both parts.
A possible improvement is to define all the other interval operations on integer pairs, so you could write code like
Interval a, b, c;
a = ...
b = ...
c = ...
IntervalPair x = a/b + c;
The "a/b" would return an IntervalPair, the "+ c" would add an IntervalPair left side to an Interval right side producing an IntervalPair, and the "x =" would store the IntervalPair "a/b + c" into IntervalPair variable x.
Allowing a divide on IntervalPair s would only be valid if you defined an IntervalQuad type and operations, and so on, and I wouldn't recommend that, but pairs could be useful.
Arnold Neumaier> 2. Similarly, one may provide perhaps implementations of inverse
Arnold Neumaier> with gap, atan2 with gap, and inverse trigonometric or hyperbolic
Arnold Neumaier> functions with gaps.
Those functions could also produce IntervalPair results.
- Ian McIntosh IBM Canada Lab Compiler Back End Support and Development
Arnold Neumaier ---03/17/2010 04:43:30 AM---Michel Hack wrote: > I agree with Jürgen's suggestion that there should be an easy way to
From: | Arnold Neumaier <Arnold.Neumaier@xxxxxxxxxxxx> |
To: | Ian McIntosh/Toronto/IBM@IBMCA |
Date: | 03/17/2010 04:43 AM |
Subject: | Re: Division in Draft Standard Text, V02.1 |