From: Gabriel D. R. <gd...@in...> - 2009-01-17 03:15:34
|
On Fri, Jan 16, 2009 at 9:05 PM, Don Cohen <don...@is...> wrote: > Gabriel Dos Reis writes: > > The call to the function log in the form > > (log (expt 234 108) 10) > > signals a floating point overflow. > > I'm not sure the hyperspec specifies an exceptional > > situation in this case. Both SBCL and GCL evaluates > > the form without fuss. > Just as a guess, the integer (expt ...) is probably being converted to > float, and this integer is too big to be converted. > Perhaps the code should check the size and use a larger float format > if necessary. I was wondering what type of result should be expected > here. I think a result as floating point number is OK -- that is what the other two Lisps do. But, a floating overflow signal is just not good... > The hyperspec says log can return either an integer or float in > cases where the result is actually an integer, but it doesn't say > anything about which type of float should be returned in any given > case. I guess for an integer it would make sense to try to return a > number of significant digits similar to the number of digits in the > integer, or as many as possible for really big integers. > Maybe the sum of the numbers of digits for the integers in rationals? > In this case the (expt ...) fits in a double float, but I still think > it should be converted to a long float, and then the log will also end > up being a long float. > hmm. -- Gaby |