Why does bfloat behave this way?



The following shows how bigfloats are stored and how a higher precision
influences the result.


(%i1) x: bfloat( 3.4567890123 );
(%o1)                           3.4567890123b0
(%i2) :lisp $%

((BIGFLOAT SIMP 56) 62271974830770816 2)
(%i2) 62271974830770816 * 2.0b0^(2-56);
(%o2)                           3.4567890123b0
(%i3) fpprec: 30$

(%i4) x: bfloat( 3.4567890123 );
(%o4)                  3.45678901229999979705098667182b0
(%i5) :lisp $%

((BIGFLOAT SIMP 102) 4382000666304443010109170253824 2)
(%i5) 4382000666304443010109170253824 * 2.0b0^(2-102);
(%o5)                  3.45678901229999979705098667182b0
(%i6) fpprec: 16$

(%i7) obase: 2$

(%i8) x: bfloat( 3.4567890123 );
(%o1000)                        3.4567890123b0
(%i9) :lisp $%

((BIGFLOAT SIMP 111000)
 11011101001111000000011111111011010000000000101010000000 10)
(%i9) fpprec: 30$

(%i10) x: bfloat( 3.4567890123 );
(%o1010)               3.45678901229999979705098667182b0
(%i11) :lisp $%

((BIGFLOAT SIMP 1100110)
 110111010011110000000111111110110100000000001010100000000000000000000000000000000000000000000000000000
 10)

HTH
Volker van Nek

Am 02.11.2013 12:29, schrieb Igor Korepanov:
> Dear all,
> 
> I have just joined this mailing list, so I would like to say first that I have enjoyed using Maxima for quite a while already, since I switched to free software a few years ago. Maxima is great, and my thanks to its creators and maintainers (I also often acknowledge this explicitly in my mathematical papers).
> 
> Now the question: why does bfloat behave exactly this way? And not some other way?
> 
> (%i1) float2bf: false;
> (%o1) false
> 
> (%i2) fpprec: 300;
> (%o2) 300
> 
> (%i3) x: bfloat( 3.4567890123 );
> bfloat: converting float 3.4567890123 to bigfloat.
> (%o3) 3.45678901229999979705098667182028293609619140625b0
> 
> Best wishes,
> 
> Igor
> 
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>