Use 1//2 instead of ((rat simp) 1 2)
[maxima.git] / src / numerical / slatec / dcsevl.lisp
blob83dfba8ef22719b1f454f69c767f6518d5c65b0c
1 ;;; Compiled by f2cl version:
2 ;;; ("f2cl1.l,v 46c1f6a93b0d 2012/05/03 04:40:28 toy $"
3 ;;; "f2cl2.l,v 96616d88fb7e 2008/02/22 22:19:34 rtoy $"
4 ;;; "f2cl3.l,v 96616d88fb7e 2008/02/22 22:19:34 rtoy $"
5 ;;; "f2cl4.l,v 96616d88fb7e 2008/02/22 22:19:34 rtoy $"
6 ;;; "f2cl5.l,v 46c1f6a93b0d 2012/05/03 04:40:28 toy $"
7 ;;; "f2cl6.l,v 1d5cbacbb977 2008/08/24 00:56:27 rtoy $"
8 ;;; "macros.l,v fceac530ef0c 2011/11/26 04:02:26 toy $")
10 ;;; Using Lisp CMU Common Lisp snapshot-2012-04 (20C Unicode)
11 ;;;
12 ;;; Options: ((:prune-labels nil) (:auto-save t) (:relaxed-array-decls t)
13 ;;; (:coerce-assigns :as-needed) (:array-type ':simple-array)
14 ;;; (:array-slicing nil) (:declare-common nil)
15 ;;; (:float-format double-float))
17 (in-package :slatec)
20 (let ((onepl 0.0) (first$ nil))
21 (declare (type (double-float) onepl) (type f2cl-lib:logical first$))
22 (setq first$ f2cl-lib:%true%)
23 (defun dcsevl (x cs n)
24 (declare (type (f2cl-lib:integer4) n)
25 (type (simple-array double-float (*)) cs)
26 (type (double-float) x))
27 (prog ((b0 0.0) (b1 0.0) (b2 0.0) (twox 0.0) (dcsevl 0.0) (ni 0) (i 0))
28 (declare (type (f2cl-lib:integer4) i ni)
29 (type (double-float) dcsevl twox b2 b1 b0))
30 (if first$ (setf onepl (+ 1.0 (f2cl-lib:d1mach 4))))
31 (setf first$ f2cl-lib:%false%)
32 (if (< n 1) (xermsg "SLATEC" "DCSEVL" "NUMBER OF TERMS <= 0" 2 2))
33 (if (> n 1000) (xermsg "SLATEC" "DCSEVL" "NUMBER OF TERMS > 1000" 3 2))
34 (if (> (abs x) onepl)
35 (xermsg "SLATEC" "DCSEVL" "X OUTSIDE THE INTERVAL (-1,+1)" 1 1))
36 (setf b1 0.0)
37 (setf b0 0.0)
38 (setf twox (* 2.0 x))
39 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
40 ((> i n) nil)
41 (tagbody
42 (setf b2 b1)
43 (setf b1 b0)
44 (setf ni (f2cl-lib:int-sub (f2cl-lib:int-add n 1) i))
45 (setf b0 (+ (- (* twox b1) b2) (f2cl-lib:fref cs (ni) ((1 *)))))
46 label10))
47 (setf dcsevl (* 0.5 (- b0 b2)))
48 (go end_label)
49 end_label
50 (return (values dcsevl nil nil nil)))))
52 (in-package #:cl-user)
53 #+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))
54 (eval-when (:load-toplevel :compile-toplevel :execute)
55 (setf (gethash 'fortran-to-lisp::dcsevl
56 fortran-to-lisp::*f2cl-function-info*)
57 (fortran-to-lisp::make-f2cl-finfo
58 :arg-types '((double-float) (simple-array double-float (*))
59 (fortran-to-lisp::integer4))
60 :return-values '(nil nil nil)
61 :calls '(fortran-to-lisp::xermsg fortran-to-lisp::d1mach))))