#197 Pickapart error (due to MEMSIMILAR)

closed
nobody
Lisp Core (472)
5
2009-11-08
2002-12-12
Stavros Macrakis
No

The Pickapart of a rather messy formula (irrelevant here)
gives:
Error: ((RAT SIMP) 1 9) is not of type NUMBER.

The problem is in the MEMSIMILAR routine:

(DEFUN MEMSIMILAR (ITEM1 ITEM2 ITEM2EV)
(COND ((EQUAL ITEM2EV 0) NIL)
((ALIKE1 ITEM1 ITEM2EV) ITEM2)
(T (LET ((ERRORSW T) R)
(SETQ R (CATCH 'ERRORSW (DIV
ITEM2EV ITEM1)))
(AND (not (zerop1 r))
;(MNUMP R) (NOT (ZEROP R))
;;; ^^^ NO! MNump includes rats and bigfloats
(DIV ITEM2 R))))))

Discussion

  • Robert Dodier
    Robert Dodier
    2006-07-01

    Logged In: YES
    user_id=501686

    Bug is presumably still present in 5.9.3cvs because
    MEMSIMILAR in src/outmis.lisp still calls MNUMP. Not clear
    how to patch MEMSIMILAR, not clear how to test if patch works.

     
  • Robert Dodier
    Robert Dodier
    2006-07-01

    • labels: --> Lisp Core
    • summary: Pickapart error: FIX --> Pickapart error (due to MEMSIMILAR)
     
  • Dieter Kaiser
    Dieter Kaiser
    2009-11-08

    That is the code in memsimiliar which causes the problem:

    (and (mnump r) ; Check for Maxima number
    (not (zerop r)) ; Test a CL number against zero
    (div item2 r)) ; Divide a tow Maxima numbers

    The test against zero is wrong. We have to use zerop1. That might be the correct code:

    (and (mnump r) ; Check for Maxima number
    (not (zerop1 r)) ; Test a Maxima number against zero
    (div item2 r)) ; Divide a tow Maxima numbers

    The problem is, I have no example to trigger the bug. But the code needs obviously the test zerop1.

    Dieter Kaiser

     
  • Dieter Kaiser
    Dieter Kaiser
    2009-11-08

    Fixed in outmis.lisp revision 1.21.
    Closing this bug report as fixed.
    Dieter Kaiser

     
  • Dieter Kaiser
    Dieter Kaiser
    2009-11-08

    • status: open --> closed