|
From: Michel T. <ta...@lp...> - 2025-12-01 17:56:05
|
Le 30/11/2025 à 18:48, Richard Fateman a écrit : > oading decfloat via load(decfp): > the following commands work > bfloat(%i) > bfloat(3) > but > bfloat(3*%i) fails. > bfloat(3*x) fails > bfloat(3+x) fails > > > The bug occurs inside a call to dectimesbigfloat, decaddbigfloat... > There's a test to see if any of the parts of the product or sum are > not convertible to decimal, in > which case the usual (binary) bigfloat is used. > but it then fails since it apparently cannot be converted to a bigfloat. Indeed this happens because in decfp-core.lisp, the lisp functions $bfloat , bigfloatp, etc. are redefined, thus there is no way to recover a clean state afterwards, and when encountering bfloat(3*%i) the program $bfloat tries to multiply bfloat(3) by bigfloatp(%i) which returns NIL, hence the error message. Any other symbol like "x" does the same as %i. Trying to force bigfloatp to return %i instead of NIL doesn't work because £bfloat expects to see a list representing a bigfloat and not a bare symbol. So the bug comes because $bfloat doesn't understand complex numbers. However in the same file decfp-core.lisp there is at the end something supporting complex numbers, and this works. maxima Loading /home/michel/.maxima/maxima-init.mac Maxima 5.48.1 https://maxima.sourceforge.io using Lisp SBCL 2.5.8 (%i1) load(decfp); redefining bigfloat %TAN to also work for decimal bigfloat redefining bigfloat %LOG to also work for decimal bigfloat redefining bigfloat %SIN to also work for decimal bigfloat redefining bigfloat %ATAN to also work for decimal bigfloat redefining bigfloat %COS to also work for decimal bigfloat (%o1) /usr/local/share/maxima/5.48.1/share/numeric/decfp.lisp (%i2) :lisp(bigfloat::bigfloat #$1+3*%i$) +1.0b0+3.0b0*%i Note this is in a special package :bigfloat. Thus i think that inserting a proper call to this function should solve the bug.But i don't see any hope that other float functions work correctly after having loaded decfp. -- Michel Talon |