From: Raymond T. <toy...@gm...> - 2022-01-10 17:00:13
|
While working on some maxima stuff, I found out that clisp can't compute acosh(most-positive-double-float). I get an overflow. Same happens with asinh. The actual answer should be about 710.475. I'm guessing this happens because clisp is using the log definition for these functions. For example, asinh(x) = log(x+sqrt(x^2+1)). So for any value above sqrt(most-positive), there's an overflow. In this case, for large enough x, sqrt(x^2+1) = x so the final answer is log(2*x). However, that would overflow if x is greater than most-positive/2. In that case, we can use log(x)+log(x). This will allow clisp to compute acosh and asinh for the entire range of floats as expected. Oh, just noticed that clisp also fails to compute sinh(710.475d0). This probably happens because sinh(x) is probably computed using (exp(x)-exp(-x))/2. exp(710.475) overflows. One possible way to avoid this is to compute exp(x/2)/sqrt(2). This won't overflow. Then square the result to get the final answer. -- Ray |