mirror of
https://github.com/PDP-10/its.git
synced 2026-01-17 16:53:23 +00:00
Resolves #284. Commented out uses of time-origin in maxtul; mcldmp (init) until we can figure out why it gives arithmetic overflows under the emulators. Updated the expect script statements in build_macsyma_portion to not attempt to match expected strings, but simply sleep for some time since in some cases the matching appears not to work.
48 lines
1.3 KiB
Common Lisp
48 lines
1.3 KiB
Common Lisp
;;;;;;;;;;;;;;;;;;; -*- Mode: Lisp; Package: Macsyma -*- ;;;;;;;;;;;;;;;;;;;
|
|
;;; (c) Copyright 1980 Massachusetts Institute of Technology ;;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(macsyma-module ops)
|
|
|
|
|
|
;;; mathematical ops to call from translated code.
|
|
;;; this is to replace maxsrc;opers, thus simplifying things,
|
|
;;; and removing extra symbols from the environment.
|
|
;;; With the OPEXPRP switch set these will also speed up
|
|
;;; macsyma arithmetic.
|
|
|
|
(DEFMACRO DEF-MARITH-NARY (MPLUS ZERO ZEROP PLUS)
|
|
`(DEFUN ,MPLUS N
|
|
(LET ((SUM ,ZERO)
|
|
(PUNT ())
|
|
(ARG))
|
|
(DO ((J 1 (1+ J)))
|
|
((> J N)
|
|
(IF (NULL PUNT) SUM
|
|
(SIMPLIFY
|
|
`((,',MPLUS) ,.(IF (,ZEROP SUM) NIL (LIST SUM))
|
|
,.PUNT))))
|
|
(SETQ ARG (ARG J))
|
|
(IF (NUMBERP ARG)
|
|
(SETQ SUM (,PLUS SUM ARG))
|
|
(PUSH ARG PUNT))))))
|
|
|
|
(DEF-MARITH-NARY MPLUS 0 ZEROP PLUS)
|
|
(DEF-MARITH-NARY MTIMES 1 ONEP TIMES)
|
|
|
|
(DEFMACRO DEF-MARITH-BINARY (MEXPT EXPT)
|
|
`(DEFUN ,MEXPT (X Y)
|
|
(IF (AND (NUMBERP X) (NUMBERP Y))
|
|
(,EXPT X Y)
|
|
(SIMPLIFY `((,',MEXPT) ,X ,Y)))))
|
|
|
|
(DEF-MARITH-BINARY MEXPT EXPT)
|
|
(DEF-MARITH-BINARY MQUOTIENT QUOTIENT)
|
|
|
|
(DEFMACRO DEF-MARITH-UNARY (MMINUS MINUS)
|
|
`(DEFUN ,MMINUS (X)
|
|
(IF (NUMBERP X) (,MINUS X) (SIMPLIFY `((,',MMINUS) ,X)))))
|
|
|
|
(DEF-MARITH-UNARY MMINUS MINUS)
|
|
|