In documentation for lreduce and rreduce, supply second argument as an explicit list
[maxima.git] / src / numerical / slatec / zsqrt.lisp
blob7db725a09813149a8292c9045198e4178064e7f8
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 ((drt 0.7071067811865476) (dpi 3.141592653589793))
21 (declare (type (double-float) drt dpi))
22 (defun zsqrt$ (ar ai br bi)
23 (declare (type (double-float) bi br ai ar))
24 (prog ((zm 0.0) (dtheta 0.0))
25 (declare (type (double-float) dtheta zm))
26 (setf zm (coerce (realpart (zabs ar ai)) 'double-float))
27 (setf zm (f2cl-lib:fsqrt zm))
28 (if (= ar 0.0) (go label10))
29 (if (= ai 0.0) (go label20))
30 (setf dtheta (f2cl-lib:datan (/ ai ar)))
31 (if (<= dtheta 0.0) (go label40))
32 (if (< ar 0.0) (setf dtheta (- dtheta dpi)))
33 (go label50)
34 label10
35 (if (> ai 0.0) (go label60))
36 (if (< ai 0.0) (go label70))
37 (setf br 0.0)
38 (setf bi 0.0)
39 (go end_label)
40 label20
41 (if (> ar 0.0) (go label30))
42 (setf br 0.0)
43 (setf bi (f2cl-lib:fsqrt (abs ar)))
44 (go end_label)
45 label30
46 (setf br (f2cl-lib:fsqrt ar))
47 (setf bi 0.0)
48 (go end_label)
49 label40
50 (if (< ar 0.0) (setf dtheta (+ dtheta dpi)))
51 label50
52 (setf dtheta (* dtheta 0.5))
53 (setf br (* zm (cos dtheta)))
54 (setf bi (* zm (sin dtheta)))
55 (go end_label)
56 label60
57 (setf br (* zm drt))
58 (setf bi (* zm drt))
59 (go end_label)
60 label70
61 (setf br (* zm drt))
62 (setf bi (* (- zm) drt))
63 (go end_label)
64 end_label
65 (return (values nil nil br bi)))))
67 (in-package #:cl-user)
68 #+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))
69 (eval-when (:load-toplevel :compile-toplevel :execute)
70 (setf (gethash 'fortran-to-lisp::zsqrt$
71 fortran-to-lisp::*f2cl-function-info*)
72 (fortran-to-lisp::make-f2cl-finfo
73 :arg-types '((double-float) (double-float) (double-float)
74 (double-float))
75 :return-values '(nil nil fortran-to-lisp::br fortran-to-lisp::bi)
76 :calls '(fortran-to-lisp::zabs))))