Raymond Toy wrote:
> Sheldon Newhouse wrote:
>
>> Following the earlier discussion in this thread (thanks fo RJF and
>> Barton), I wrote the following function which relates fpprec and ?fpprec.
>>
>> (%t112) fp_bits(n):=floor(log(bfloat(10)^n)/log(bfloat(2)))+3
>>
>>
>
> Why experiment when we have the actual source code? :-)
>
> Thus, fpprec is computed from $fpprec via the function fpprec1. (Great
> function name! No way to figure that out except by reading the code
> And you can't figure out how to call fpprec1 without reading more code
> to see how it's used.)
>
> Anyway, fpprec1 computes fpprec as (+ 2 (integer-length (expt 10
> $fpprec))). This is pretty much what Sheldon has, except there's a
> potential for roundoff in his formula. Probably doesn't occur for
> sensible values of $fpprec.
>
> Ray
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
OK, so we might as well define the function fp_bits as
:lisp (defun $fp_bits(n)(+ 2 (integer-length (expt 10 n))))
Then, there is no ambiguity.
Thanks,
-sen