bfloat implementation and overflows



You can see the internal format of a bfloat (or any other Maxima object)
using ?print:

     ?print(-2.3b0)
    ((BIGFLOAT SIMP 56) -41433116571808563 2)

This denotes -41433116571808563 * 2^(2-56).  There is no hidden bit and the
sign is not included in the bit count. You can see that the significand has
56 bits, as 2^55 < 41433116571808563 < 2^56.

Both the significand and the exponent are represented using normal Lisp
numbers, which can be "bignums", that is, limited only by the size of
memory (see previous discussion about 2^3^4^5).  So Maxima can represent
numbers like big: 2^(10^1000) as bfloats -- just enter this as
2^(10b0^1000) -- and perform arithmetic on them: log(big)/log(2b0) =>
1.0b1000.  Of course, some calculations are infeasible for numbers like
this: to calculate sin(big), Maxima would have to calculate %pi to over
10^1000 digits.

               -s

On Thu, Jun 7, 2012 at 9:18 AM, Jorge Calvo <Jorge.Calvo at avemaria.edu>wrote:

> Hello:
>
> I'm trying to understand a little about Maxima's implementation of big
> floats, and have three questions:
>
> First of all, from what I have read so far in the archive, the size of the
> significand is determined by the variable fpprec and ?fpprec.  Setting
> fpprec to some number of decimal digits of precision automatically sets
> ?fpprec to the required number of bits.  So, for example, when fpprec = 16,
> then ?fpprec = 56.  This is more than Maxima's regular floats (following
> the IEEE double standard of 53); the reason is, presumably, to allow for
> proper conversion of 16 digit numbers from decimal to binary and back to
> decimal without rounding.  Am I understanding this correctly
>
> My second question is this:  The bit count for regular floats (again
> following IEEE) includes a sign bit but not the hidden bit (the most
> significant bit in the significand/mantissa).  This means that you
> effectively get 53 bits to encode the magnitude of the significand (at
> least when its normalized).  Does Maxima do the same with big floats?  Or
> does ?fpprec = 56 mean one sign bit and 55 magnitude bits?
>
> My third question concerns the exponent part of the big float.  A little
> experimentation shows that it can get pretty big without causing an
> overflow.  Is there an inherent upper limit built in to Maxima?  Or is it
> only limited by the underlying version of Lisp and/or the storage capacity
> of the computer?
>
> Many thanks in advance!
>
> Jorge
> --
> Dr. Jorge Alberto Calvo
> Associate Professor of Mathematics
> Department of Mathematics and Physics
> Ave Maria University
>
> Phone: (239) 280-1608
> Email: jorge.calvo at avemaria.edu<mailto:jorge.calvo at avemaria.edu>
> Web: http://sites.google.com/site/jorgealbertocalvo
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>