[Maxima] bfloat implementation and overflows
fateman at eecs.berkeley.edu
Thu Jun 7 09:02:31 CDT 2012
On 6/7/2012 6:18 AM, Jorge Calvo wrote:
> 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.
Rounding is done, anyway. IEEE floats are not 16 decimal digits, but
binary floats, as you know.
> Am I understanding this correctly
You can read the programs that implement big floats. In the file float.lisp
> 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?
The sign bit is not counted. There is no hidden bit. You can easily
the representation by encoding numbers like 1+ 2^(-56) and see what
You can look at a bigfloat in lisp by ?print(1.234b0)
> 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?
The exponent is a lisp integer, which as you know, can represent quite
> Or is it only limited by the underlying version of Lisp and/or the storage capacity of the computer?
The bigfloat package does not impose any additional limit on exponent
size, and does not
make provision for the concepts of exponent underflow and overflow .
More information about the Maxima