Path: utzoo!attcan!uunet!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!hiyall.enet.dec.com!reagan From: reagan@hiyall.enet.dec.com (John R. Reagan) Newsgroups: comp.lang.pascal Subject: Re: TP: Exponentiation? Message-ID: <14539@shlump.nac.dec.com> Date: 13 Aug 90 16:57:44 GMT Sender: newsdaemon@shlump.nac.dec.com Organization: Digital Equipment Corporation Lines: 36 In article <26C3B78F.8576@ics.uci.edu>, milne@ics.uci.edu (Alastair Milne) writes... > > Does the standard say anything about how they are implemented? > I understand that Wirth decided to omit exponentiation from his > original version of the language in part because implementations > of the operator tended to be unsatisfactory. The following is from the standard: A factor of the form x**y shall be an error if x is zero and y is less than or equal to zero. A factor of the form x**y, where x is of integer-type or real-type, shall be an error if x is negative; otherwise, the value of x**y shall be zero if x is zero, else 1.0 if y is zero, else an approximation to (though not necessarily calculated by) exp(y*ln(x)). A factor of the form x pow y shall be an error if x is zero and y is less than or equal to zero. The value of a factor of the form x pow y, where x is of integer-type, shall be zero if x is zero, else 1 if y is zero, else queal to x*(x pow (y-1)) if y is positive, else equal to (1 div x) pow (-y) if y is negative. The quality is an implementation/vendor issue independent of the definition of the language. If your vendor provides a slow or inaccurate exponentation, then complain to your vendor... --- John Reagan Digital Equipment Corporation reagan@hiyall.dec.com ---