~peterpall/maxima/+git/maxima.code:rtoy-fix-eng-format

Last commit made on 2021-10-10
Get this branch:
git clone -b rtoy-fix-eng-format https://git.launchpad.net/~peterpall/maxima/+git/maxima.code

Branch merges

Branch information

Name:
rtoy-fix-eng-format
Repository:
lp:~peterpall/maxima/+git/maxima.code

Recent commits

7a8b1ab... by kjak

translator: fix MQAPPLY array assignments when translate_fast_arrays:true

This is a very old Maxima bug that was not present in Macsyma.

In the translate_fast_arrays case, MASET did not handle the MQAPPLY
case. A lisp error would occur at runtime when attempting the
assignment.

(%i1) foo () := (a : make_array ('fixnum, 5), b() := a, b()[1] : 5)$

(%i2) translate_fast_arrays : true$

(%i3) translate (foo)$

(%i4) foo ();
<lisp error>

Now a special case for MQAPPLY has been added to MASET (similar to
the special case that exists in MAREF).

No problems with the test suite or share test suite. A new test has
been added to rtest_translator.

6f93c0b... by kjak

MARRAYREF: fix an incorrectly constructed expression passed to ARRFIND

This is an ancient bug that was present in Macsyma.

When use_fast_arrays:false, MARRAYREF would pass an expression to
ARRFIND without the ARRAY flag in some cases. The header would
actually contain the symbol holding the array instead of the intended
ARRAY flag.

This bug affected various things, such as arrayapply, translated array
references and translated calls to subvar.

(%i1) array (a, complete, 5)$

(%i2) arrayapply (a, [3]);
(%o2) a(3)

No problems with the test suite or share test suite. New tests have
been added to rtest2 and rtest_translator.

170c6c1... by Robert Dodier <email address hidden>

Fix SF bug #3654 in eigen.mac a different way
(via local instead of (+foo)[i] workaround), essentially reverting commit a58e06
to eigen.mac and fixing it a different way.

This corrects a problem reported to the mailing list circa 2021-09-28,
that running run_testsuite(share_tests = true) reports that rtest_eigen
runs into a Maxima error ("cannot assign to" subscripted expression).

So the immediate problem is fixed, but the underlying problem is that
rules applied to MQAPPLY (as in rtest6 circa line 82) change the
way MQAPPLY expressions are simplified. I have opened a bug report,
SF #3870: "rules applied to MQAPPLY change default simplification"

878121b... by Leo Butler

Patch to ask-prop: replace '| | with the string " "

The blank symbol is used to typeset a space, but it is escaped in the
bowels of aformat, since it is a symbol.

See:

https://sourceforge.net/p/maxima/patches/102/
https://trac.sagemath.org/ticket/31553

ecce562... by Leo Butler

Add alt_display functions for text, 1d and 2d output

In define_alt_display, define alt_display function so that output text
is automatically emitted by alt_display_text function; leave other
cases up to the function maker.

Add alt_display_text_prefix/suffix to customize the output of
alt_display_text.

Add an example, based on Eric Stemmler's requests, for multiple
printed output blocks.

f268f9c... by Raymond Toy <email address hidden>

Refactor implementation

Put the code that computes log10 and the code that fixes up bad format
output into their own flet so we can more easily change the
implementation if needed.

Add more comments as well, including an example of why we need the
fixup.

c35a17e... by Raymond Toy <email address hidden>

Update expectations for eng format test

Cmucl, ecl, and sbcl pass the tests now.

8fd8433... by Raymond Toy <email address hidden>

Update expected results for eng format

Curiously, the test makelist(sdowncase(sconcat(1.0*10^x)),x,-20,20)
expected incorrect results like 100.0e+7 instead of 1.0e+9. I've
updated these to be the correct values, even if eng format may not be
right. (But cmucl does get these all right.)

7966357... by Raymond Toy <email address hidden>

Clean up and add comments describing how things work.

Also add a defvar so we can enable debugging prints whenever we want
to.

c1f03d3... by Raymond Toy <email address hidden>

Fix printing for engineering format.

Due to round-off problems the computation of n = floor(log10(x)) where
x is the number to be printed is sometimes too small.

To solve this, we test if 10.0^n <= x < 10.0^n. If it fails, then the
exponent is too small by 1, so we increase n by 1. This takes care of
most cases.

However, that's not enough. Some lisps like ecl (20.4.24) end up
still printing a number that doesn't have the right exponent:

> (format t "~,v,,ve" 15 2 1d10)
100.00000000000000d+8

So we check that the printed exponent is a multiple of 3. If not, we
decrement the scale factor by 1 which seems to fix things. For ecl,
we get:

> (format t "~,v,,ve" 15 1 1d10)
10.000000000000000d+9

However, ccl64 1.12 on Linux, at least, is broken and we can't do
anything about it:

? (format t "~,v,,ve" 15 2 1d10)
10.00000000000000D+8

The printed result is off by a factor of 10; the exponent should be
9. Other lisps I tried (clisp, cmucl, gcl) print this correctly.

There may be other cases where things are wrong. I only used

makelist(float(10^i),i,-10,10);

for testing.