comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Math functions in Ada
Date: 1997/05/16
Date: 1997-05-16T00:00:00+00:00	[thread overview]
Message-ID: <dewar.863802646@merv> (raw)
In-Reply-To: 5lhvrk$cqj@mtinsc05.worldnet.att.net


Jacob says

<<First of all, x**y equals exp(y * log(x)).  So, all you need are the
log (logarithm) and exp (exponential) functions.  It should be failrly
easy to write such a function as log and exp are generally provided.
Indeed, the whole thing would be:>>


AARGH! This is a *horrible* equivalence to use in any program, since the
error bounds are simply awful. In other words, even with a perfectly
accurate exp and log, the result of computing x**y can be way off (hundreds
of ULP's) 

True, as Jacob suggests, if you can use a higher precisoin intermediate
type, then this formula is OK, and indeed one of the classic illustrations
of the utility of IEEE extended precision is precisely this one (i.e. if
you have accurate extended precision long and exp, as on the x86, then
you can compute long_form x**y accurately. For a detailed analysis of 
this case, see chapter 5 of my book on Microprocessors.






  reply	other threads:[~1997-05-16  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-01  0:00 Math functions in Ada William Frye
1997-05-01  0:00 ` David C. Hoos, Sr.
1997-05-05  0:00   ` Doug Smith
1997-05-06  0:00   ` Keith Thompson
1997-05-16  0:00 ` Jacob S. Rosenberg.
1997-05-16  0:00   ` Robert Dewar [this message]
1997-05-17  0:00   ` John G. Volan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox