stt@inmet.inmet.com (01/06/90)
An Ada expression is always allowed to evaluate to a result more accurate than that required by the type. This can be due either to compile-time infinite precision calculation, or by simply using greater precision at run-time. The only absolute requirement for accuracy has to do with operations where both operands are model numbers. See ARM 4.5.7. S. Tucker Taft Intermetrics, Inc. Cambridge, MA 02138
stt@inmet.inmet.com (01/09/90)
With regard to accuracy of compile-time calculations... In ARM 4.10:4, it states: . . . Furthermore, if a universal expression is a static expression, then the evaluation must be exact. Let's hope they don't try to define "SQRT" on universal reals ! ;-* S. Tucker Taft Intermetrics, Inc. Cambridge, MA 02138
firth@sei.cmu.edu (Robert Firth) (01/09/90)
In article <20600032@inmet> stt@inmet.inmet.com writes: >In ARM 4.10:4, it states: > . . . Furthermore, if a universal expression is a static expression, >then the evaluation must be exact. > >Let's hope they don't try to define "SQRT" on universal reals ! ;-* The sentence quoted was perpetrated by one of the Neoplatonists on the language design team. The point of the joke, of course, is that in Ada all 'universal' expressions yield only rational results, and so may indeed be computed exactly.
bagpiper@pnet02.gryphon.com (Michael Hunter) (01/10/90)
firth@sei.cmu.edu (Robert Firth) writes: >In article <20600032@inmet> stt@inmet.inmet.com writes: > >>In ARM 4.10:4, it states: >> . . . Furthermore, if a universal expression is a static expression, >>then the evaluation must be exact. >> >>Let's hope they don't try to define "SQRT" on universal reals ! ;-* > >The sentence quoted was perpetrated by one of the Neoplatonists on >the language design team. The point of the joke, of course, is that >in Ada all 'universal' expressions yield only rational results, and >so may indeed be computed exactly. I'm missing something here....no matter how hard to try to compute the square root of 2....you ain't gonna get it exactly...I don't care if you are doing your arithmatic with rational immediate results!! The sqare root of 2 doesn't exist in the rationals!!!! (go check with your college abstract algebra book or if you want overkill check out galois theory!) Now you can computer the root of 2 to maximum percision of the hardware percisely...that is a different matter...! Michael Mike Hunter - Box's and CPU's from HELL: iapx80[012]86, PR1ME 50 Series, 1750a UUCP: {ames!elroy, <routing site>}!gryphon!pnet02!bagpiper INET: bagpiper@pnet02.gryphon.com
stt@inmet.inmet.com (01/11/90)
As Robert Firth said, the point of my joke about SQRT on universals was exactly that the result is not always a rational number. The definition of Ada does not currently include any operations on universal reals which produce irrational results. If we were to add SQRT, then the cited wording would have to change. I have no expectation that SQRT will be added to the set of operations defined on universal reals, by the way... S. Tucker Taft Intermetrics, Inc. Cambridge, MA 02138 P.S. I wouldn't rule out some clever implementation which could represent all algebraic numbers "exactly", but it would clearly have to be more complicated than simply a pair of universal integers as is used for rationals (probably a tree structure of some sort, requiring symbolic evaluation, etc). -T
bagpiper@pnet02.gryphon.com (Michael Hunter) (01/12/90)
stt@inmet.inmet.com writes: > >As Robert Firth said, the point of my joke about SQRT on universals >was exactly that the result is not always a rational number. Someone on the net said that I insulted you with my comment that the square root of two is not rational. I apologize if I did. Michael Mike Hunter - Box's and CPU's from HELL: iapx80[012]86, PR1ME 50 Series, 1750a UUCP: {ames!elroy, <routing site>}!gryphon!pnet02!bagpiper INET: bagpiper@pnet02.gryphon.com