
(/VERSIONCHECK 2) 

(DEFUN |FSFUN;bernoulli_gamma_series| (|z| |n| $)
  (PROG (|zinv| |z2inv| |k| |zk| |kinv| |bk| |s|)
    (RETURN
      (SEQ (LETT |zinv|
                 (SPADCALL (|spadConstant| $ 7) |z| (QREFELT $ 8))
                 . #0=(|FSFUN;bernoulli_gamma_series|))
           (LETT |zk| |zinv| . #0#)
           (LETT |z2inv| (SPADCALL |zinv| |zinv| (QREFELT $ 9)) . #0#)
           (LETT |s|
                 (SPADCALL |zk|
                     (SPADCALL (SPADCALL 1 12 (QREFELT $ 12))
                         (QREFELT $ 13))
                     (QREFELT $ 9)) . #0#)
           (SEQ (LETT |k| 1 . #0#) G190
                (COND ((QSGREATERP |k| |n|) (GO G191)))
                (SEQ (LETT |zk|
                           (SPADCALL |zk| |z2inv| (QREFELT $ 9)) . #0#)
                     (LETT |kinv|
                           (SPADCALL (|spadConstant| $ 15)
                               (SPADCALL
                                   (*
                                    (+ (SPADCALL 2 |k| (QREFELT $ 18))
                                     2)
                                    (+ (SPADCALL 2 |k| (QREFELT $ 18))
                                     1))
                                   (QREFELT $ 19))
                               (QREFELT $ 20)) . #0#)
                     (LETT |bk|
                           (SPADCALL
                               (SPADCALL
                                   (+ (SPADCALL 2 |k| (QREFELT $ 18))
                                    2)
                                   (QREFELT $ 22))
                               (QREFELT $ 23)) . #0#)
                     (EXIT (LETT |s|
                                 (SPADCALL |s|
                                     (SPADCALL
                                      (SPADCALL
                                       (SPADCALL |bk| |kinv|
                                        (QREFELT $ 24))
                                       (QREFELT $ 25))
                                      |zk| (QREFELT $ 9))
                                     (QREFELT $ 26)) . #0#)))
                (LETT |k| (QSADD1 |k|) . #0#) (GO G190) G191
                (EXIT NIL))
           (EXIT |s|))))) 

(DEFUN |FSFUN;logGamma_a1| (|z| $)
  (SPADCALL
      (SPADCALL
          (SPADCALL
              (SPADCALL |z|
                  (SPADCALL (SPADCALL 1 2 (QREFELT $ 12))
                      (QREFELT $ 13))
                  (QREFELT $ 27))
              (SPADCALL |z| (QREFELT $ 28)) (QREFELT $ 9))
          |z| (QREFELT $ 27))
      (SPADCALL (SPADCALL (SPADCALL 1 2 (QREFELT $ 12)) (QREFELT $ 13))
          (SPADCALL
              (SPADCALL (SPADCALL 2 (QREFELT $ 19))
                  (SPADCALL (QREFELT $ 29)) (QREFELT $ 30))
              (QREFELT $ 28))
          (QREFELT $ 9))
      (QREFELT $ 26))) 

(DEFUN |FSFUN;logGamma_asymptotic| (|z| |n| $)
  (PROG (|lg1|)
    (RETURN
      (SEQ (LETT |lg1| (|FSFUN;logGamma_a1| |z| $)
                 |FSFUN;logGamma_asymptotic|)
           (EXIT (SPADCALL |lg1|
                     (|FSFUN;bernoulli_gamma_series| |z| |n| $)
                     (QREFELT $ 26))))))) 

(DEFUN |FSFUN;gamma_series| (|z| |l| |n| $)
  (PROG (|k| |tk| |s|)
    (RETURN
      (SEQ (LETT |tk|
                 (SPADCALL
                     (SPADCALL
                         (SPADCALL |z|
                             (SPADCALL (SPADCALL |l| (QREFELT $ 31))
                                 (QREFELT $ 25))
                             (QREFELT $ 9))
                         (QREFELT $ 32))
                     |z| (QREFELT $ 8))
                 . #0=(|FSFUN;gamma_series|))
           (LETT |s| |tk| . #0#)
           (SEQ (LETT |k| 1 . #0#) G190
                (COND ((QSGREATERP |k| |n|) (GO G191)))
                (SEQ (LETT |tk|
                           (SPADCALL
                               (SPADCALL |tk|
                                   (SPADCALL |l| (QREFELT $ 25))
                                   (QREFELT $ 9))
                               (SPADCALL |z|
                                   (SPADCALL |k| (QREFELT $ 33))
                                   (QREFELT $ 26))
                               (QREFELT $ 8)) . #0#)
                     (EXIT (LETT |s|
                                 (SPADCALL |s| |tk| (QREFELT $ 26)) . #0#)))
                (LETT |k| (QSADD1 |k|) . #0#) (GO G190) G191
                (EXIT NIL))
           (EXIT (SPADCALL |s|
                     (SPADCALL
                         (SPADCALL (SPADCALL |l| (QREFELT $ 34))
                                   (QREFELT $ 35))
                         (QREFELT $ 25))
                     (QREFELT $ 9))))))) 

(DEFUN |FSFUN;Gamma;2C;5| (|z| $)
  (PROG (|l0| |l| |re_z| |c_pi| |one| |abs_z| #0=#:G1839 |oz|
              #1=#:G1840 |lz| |loss| |len| #2=#:G1841 #3=#:G1843 |llog|
              #4=#:G1846 |l1| |result|)
    (RETURN
      (SEQ (COND
             ((SPADCALL (SPADCALL (QREFELT $ 36)) 2 (QREFELT $ 38))
              (|error| "Gamma can only handle base 2 Float-s"))
             ('T
              (SEQ (LETT |l0| (SPADCALL (QREFELT $ 39))
                         . #5=(|FSFUN;Gamma;2C;5|))
                   (LETT |l| (MAX (+ |l0| 5) 20) . #5#)
                   (LETT |re_z| (SPADCALL |z| (QREFELT $ 40)) . #5#)
                   (EXIT (COND
                           ((SPADCALL |re_z|
                                (SPADCALL (|spadConstant| $ 15) 2
                                    (QREFELT $ 41))
                                (QREFELT $ 42))
                            (COND
                              ((SPADCALL |re_z| (QREFELT $ 44))
                               (|error| "Pole of Gamma"))
                              ('T
                               (SEQ (SPADCALL (+ |l| 5) (QREFELT $ 45))
                                    (LETT |c_pi|
                                     (SPADCALL (QREFELT $ 29)) . #5#)
                                    (LETT |one|
                                     (|spadConstant| $ 7) . #5#)
                                    (LETT |result|
                                     (SPADCALL |c_pi|
                                      (SPADCALL
                                       (SPADCALL
                                        (SPADCALL |one| |z|
                                         (QREFELT $ 27))
                                        (QREFELT $ 46))
                                       (SPADCALL
                                        (SPADCALL |c_pi| |z|
                                         (QREFELT $ 9))
                                        (QREFELT $ 47))
                                       (QREFELT $ 9))
                                      (QREFELT $ 8)) . #5#)
                                    (SPADCALL |l0| (QREFELT $ 45))
                                    (EXIT |result|)))))
                           ('T
                            (SEQ (LETT |abs_z|
                                       (SPADCALL
                                        (SPADCALL |z| (QREFELT $ 48))
                                        (QREFELT $ 40)) . #5#)
                                 (EXIT (COND
                                         ((SPADCALL
                                           (SPADCALL 6 |abs_z|
                                            (QREFELT $ 49))
                                           (SPADCALL |l|
                                            (QREFELT $ 19))
                                           (QREFELT $ 42))
                                          (SEQ
                                           (LETT |oz|
                                            (PROG1
                                             (LETT #0#
                                              (MAX
                                               (SPADCALL |abs_z|
                                                (QREFELT $ 51))
                                               5) . #5#)
                                              (|check-subtype|
                                               (> #0# 0)
                                               '(|PositiveInteger|)
                                               #0#)) . #5#)
                                           (LETT |lz|
                                            (PROG1
                                             (LETT #1#
                                              (INTEGER-LENGTH |oz|) . #5#)
                                              (|check-subtype|
                                               (> #1# 0)
                                               '(|PositiveInteger|)
                                               #1#)) . #5#)
                                           (SPADCALL
                                            (+ (+ |oz| |lz|) 30)
                                            (QREFELT $ 45))
                                           (LETT |loss|
                                            (SPADCALL
                                             (SPADCALL
                                              (|FSFUN;logGamma_a1|
                                               (SPADCALL
                                                (SPADCALL |z|
                                                 (QREFELT $ 40))
                                                (QREFELT $ 25))
                                               $)
                                              (QREFELT $ 40))
                                             (SPADCALL
                                              (|FSFUN;logGamma_a1| |z|
                                               $)
                                              (QREFELT $ 40))
                                             (QREFELT $ 52)) . #5#)
                                           (LETT |len|
                                            (SPADCALL
                                             (SPADCALL
                                              (SPADCALL 2
                                               (SPADCALL |z|
                                                (QREFELT $ 40))
                                               (QREFELT $ 49))
                                              (SPADCALL 2
                                               (SPADCALL |loss|
                                                (SPADCALL
                                                 (SPADCALL
                                                  (QREFELT $ 53))
                                                 (SPADCALL |l|
                                                  (QREFELT $ 19))
                                                 (QREFELT $ 24))
                                                (QREFELT $ 54))
                                               (QREFELT $ 49))
                                              (QREFELT $ 54))
                                             (SPADCALL 3
                                              (QREFELT $ 19))
                                             (QREFELT $ 54)) . #5#)
                                           (LETT |l1|
                                            (PROG1
                                             (LETT #2#
                                              (+
                                               (+
                                                (+ |l|
                                                 (SPADCALL |len|
                                                  (QREFELT $ 51)))
                                                (SPADCALL
                                                 (SPADCALL |loss|
                                                  (SPADCALL
                                                   (QREFELT $ 53))
                                                  (QREFELT $ 24))
                                                 (QREFELT $ 55)))
                                               12) . #5#)
                                              (|check-subtype|
                                               (> #2# 0)
                                               '(|PositiveInteger|)
                                               #2#)) . #5#)
                                           (SPADCALL |l1|
                                            (QREFELT $ 45))
                                           (LETT |result|
                                            (|FSFUN;gamma_series| |z|
                                             |len|
                                             (+
                                              (SPADCALL 4
                                               (SPADCALL |len|
                                                (QREFELT $ 55))
                                               (QREFELT $ 56))
                                              6)
                                             $) . #5#)
                                           (SPADCALL |l0|
                                            (QREFELT $ 45))
                                           (EXIT |result|)))
                                         ('T
                                          (SEQ
                                           (LETT |llog|
                                            (PROG1
                                             (LETT #3#
                                              (MAX
                                               (SPADCALL
                                                (SPADCALL
                                                 (SPADCALL
                                                  (|FSFUN;logGamma_a1|
                                                   |z| $)
                                                  (QREFELT $ 48))
                                                 (QREFELT $ 40))
                                                (QREFELT $ 51))
                                               5) . #5#)
                                              (|check-subtype|
                                               (> #3# 0)
                                               '(|PositiveInteger|)
                                               #3#)) . #5#)
                                           (LETT |l1|
                                            (+
                                             (+ (+ |l| |llog|)
                                              (PROG1
                                               (LETT #4#
                                                (INTEGER-LENGTH |l|) . #5#)
                                                (|check-subtype|
                                                 (> #4# 0)
                                                 '(|PositiveInteger|)
                                                 #4#)))
                                             7) . #5#)
                                           (SPADCALL |l1|
                                            (QREFELT $ 45))
                                           (LETT |result|
                                            (SPADCALL
                                             (|FSFUN;logGamma_asymptotic|
                                              |z|
                                              (+ (QUOTIENT2 |l| 6) 1)
                                              $)
                                             (QREFELT $ 32)) . #5#)
                                           (SPADCALL |l0|
                                            (QREFELT $ 45))
                                           (EXIT |result|)))))))))))))))) 

(DEFUN |FSFUN;logGamma_lift| (|z| |lg2| $)
  (PROG (|lg2i| |k|)
    (RETURN
      (SEQ (LETT |lg2i| (SPADCALL |lg2| (QREFELT $ 57))
                 . #0=(|FSFUN;logGamma_lift|))
           (LETT |k|
                 (SPADCALL
                     (SPADCALL
                         (SPADCALL
                             (SPADCALL (|FSFUN;logGamma_a1| |z| $)
                                 (QREFELT $ 57))
                             |lg2i| (QREFELT $ 52))
                         (SPADCALL 2 (SPADCALL (QREFELT $ 58))
                             (QREFELT $ 49))
                         (QREFELT $ 20))
                     (QREFELT $ 59)) . #0#)
           (EXIT (SPADCALL |lg2|
                     (SPADCALL (SPADCALL (QREFELT $ 60))
                         (SPADCALL
                             (SPADCALL |k| (SPADCALL 2 (QREFELT $ 19))
                                 (QREFELT $ 24))
                             (SPADCALL (QREFELT $ 29)) (QREFELT $ 30))
                         (QREFELT $ 9))
                     (QREFELT $ 26))))))) 

(DEFUN |FSFUN;logGamma;2C;7| (|z| $)
  (PROG (|l0| |re_z| |one| |c_pi| |abs_z| |l| #0=#:G1861 |l1| |result|)
    (RETURN
      (SEQ (COND
             ((SPADCALL (SPADCALL (QREFELT $ 36)) 2 (QREFELT $ 38))
              (|error| "Gamma can only handle base 2 Float-s"))
             ('T
              (SEQ (LETT |l0| (SPADCALL (QREFELT $ 39))
                         . #1=(|FSFUN;logGamma;2C;7|))
                   (LETT |l| (MAX (+ |l0| 5) 20) . #1#)
                   (LETT |re_z| (SPADCALL |z| (QREFELT $ 40)) . #1#)
                   (LETT |one| (|spadConstant| $ 7) . #1#)
                   (EXIT (COND
                           ((SPADCALL |re_z|
                                (SPADCALL (|spadConstant| $ 15) 2
                                    (QREFELT $ 41))
                                (QREFELT $ 42))
                            (COND
                              ((SPADCALL |re_z| (QREFELT $ 44))
                               (|error| "Pole of Gamma"))
                              ('T
                               (SEQ (SPADCALL (+ |l| 5) (QREFELT $ 45))
                                    (LETT |c_pi|
                                     (SPADCALL (QREFELT $ 29)) . #1#)
                                    (LETT |result|
                                     (SPADCALL
                                      (SPADCALL
                                       (SPADCALL |c_pi| (QREFELT $ 28))
                                       (SPADCALL
                                        (SPADCALL |one| |z|
                                         (QREFELT $ 27))
                                        (QREFELT $ 61))
                                       (QREFELT $ 27))
                                      (SPADCALL
                                       (SPADCALL
                                        (SPADCALL |c_pi| |z|
                                         (QREFELT $ 9))
                                        (QREFELT $ 47))
                                       (QREFELT $ 28))
                                      (QREFELT $ 27)) . #1#)
                                    (LETT |result|
                                     (|FSFUN;logGamma_lift| |z|
                                      |result| $) . #1#)
                                    (SPADCALL |l0| (QREFELT $ 45))
                                    (EXIT |result|)))))
                           ('T
                            (SEQ (LETT |abs_z|
                                       (SPADCALL
                                        (SPADCALL |z| (QREFELT $ 48))
                                        (QREFELT $ 40)) . #1#)
                                 (EXIT (COND
                                         ((SPADCALL
                                           (SPADCALL 6 |abs_z|
                                            (QREFELT $ 49))
                                           (SPADCALL |l|
                                            (QREFELT $ 19))
                                           (QREFELT $ 42))
                                          (SEQ
                                           (LETT |l| (+ |l| 5) . #1#)
                                           (COND
                                             ((OR
                                               (SPADCALL
                                                (SPADCALL
                                                 (SPADCALL
                                                  (SPADCALL |z| |one|
                                                   (QREFELT $ 27))
                                                  (QREFELT $ 48))
                                                 (QREFELT $ 40))
                                                (SPADCALL
                                                 (|spadConstant| $ 15)
                                                 4 (QREFELT $ 41))
                                                (QREFELT $ 42))
                                               (SPADCALL
                                                (SPADCALL
                                                 (SPADCALL
                                                  (SPADCALL
                                                   (SPADCALL |z| |one|
                                                    (QREFELT $ 27))
                                                   |one|
                                                   (QREFELT $ 27))
                                                  (QREFELT $ 48))
                                                 (QREFELT $ 40))
                                                (SPADCALL
                                                 (|spadConstant| $ 15)
                                                 4 (QREFELT $ 41))
                                                (QREFELT $ 42)))
                                              (LETT |l|
                                               (* 2 |l|) . #1#)))
                                           (SPADCALL |l|
                                            (QREFELT $ 45))
                                           (LETT |result|
                                            (|FSFUN;logGamma_lift| |z|
                                             (SPADCALL
                                              (SPADCALL |z|
                                               (QREFELT $ 46))
                                              (QREFELT $ 28))
                                             $) . #1#)
                                           (SPADCALL |l0|
                                            (QREFELT $ 45))
                                           (EXIT |result|)))
                                         ('T
                                          (SEQ
                                           (LETT |l1|
                                            (+
                                             (+ |l|
                                              (PROG1
                                               (LETT #0#
                                                (INTEGER-LENGTH |l|) . #1#)
                                                (|check-subtype|
                                                 (> #0# 0)
                                                 '(|PositiveInteger|)
                                                 #0#)))
                                             7) . #1#)
                                           (SPADCALL |l1|
                                            (QREFELT $ 45))
                                           (LETT |result|
                                            (|FSFUN;logGamma_asymptotic|
                                             |z|
                                             (+ (QUOTIENT2 |l| 6) 1) $) . #1#)
                                           (SPADCALL |l0|
                                            (QREFELT $ 45))
                                           (EXIT |result|)))))))))))))))) 

(DEFUN |FSFUN;Gamma;2F;8| (|x| $)
  (SPADCALL (SPADCALL (SPADCALL |x| (QREFELT $ 25)) (QREFELT $ 46))
      (QREFELT $ 40))) 

(DEFUN |FSFUN;logGamma;2F;9| (|x| $)
  (COND
    ((SPADCALL (|spadConstant| $ 64) |x| (QREFELT $ 42))
     (SPADCALL (SPADCALL (SPADCALL |x| (QREFELT $ 25)) (QREFELT $ 61))
         (QREFELT $ 40)))
    ('T (|error| "Agrument to logGamma <= 0")))) 

(DEFUN |FloatSpecialFunctions| ()
  (PROG ()
    (RETURN
      (PROG (#0=#:G1870)
        (RETURN
          (COND
            ((LETT #0#
                   (HGET |$ConstructorCache| '|FloatSpecialFunctions|)
                   . #1=(|FloatSpecialFunctions|))
             (|CDRwithIncrement| (CDAR #0#)))
            ('T
             (UNWIND-PROTECT
               (PROG1 (CDDAR (HPUT |$ConstructorCache|
                                   '|FloatSpecialFunctions|
                                   (LIST
                                    (CONS NIL
                                     (CONS 1
                                      (|FloatSpecialFunctions;|))))))
                 (LETT #0# T . #1#))
               (COND
                 ((NOT #0#)
                  (HREM |$ConstructorCache| '|FloatSpecialFunctions|))))))))))) 

(DEFUN |FloatSpecialFunctions;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT |dv$| '(|FloatSpecialFunctions|)
              . #0=(|FloatSpecialFunctions|))
        (LETT $ (GETREFV 66) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache| '|FloatSpecialFunctions| NIL
            (CONS 1 $))
        (|stuffDomainSlots| $)
        $)))) 

(MAKEPROP '|FloatSpecialFunctions| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|Complex| 14) (0 . |One|) (4 . /)
             (10 . *) (|Integer|) (|Fraction| 10) (16 . /)
             (22 . |coerce|) (|Float|) (27 . |One|) (|PositiveInteger|)
             (|NonNegativeInteger|) (31 . *) (37 . |coerce|) (42 . /)
             (|IntegerNumberTheoryFunctions|) (48 . |bernoulli|)
             (53 . |coerce|) (58 . *) (64 . |coerce|) (69 . +) (75 . -)
             (81 . |log|) (86 . |pi|) (90 . *) (96 . |log|)
             (101 . |exp|) (106 . |coerce|) (111 . -) (116 . |exp|)
             (121 . |base|) (|Boolean|) (125 . ~=) (131 . |bits|)
             (135 . |real|) (140 . /) (146 . <)
             (|IntegerRetractions| 14) (152 . |integer?|)
             (157 . |bits|) |FSFUN;Gamma;2C;5| (162 . |sin|)
             (167 . |abs|) (172 . *) (178 . |max|) (182 . |order|)
             (187 . -) (193 . |log2|) (197 . +) (203 . |wholePart|)
             (208 . *) (214 . |imag|) (219 . |pi|) (223 . |round|)
             (228 . |imaginary|) |FSFUN;logGamma;2C;7|
             |FSFUN;Gamma;2F;8| (232 . |Zero|) (236 . |Zero|)
             |FSFUN;logGamma;2F;9|)
          '#(|logGamma| 240 |Gamma| 250) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 65
                                '(0 6 0 7 2 6 0 0 0 8 2 6 0 0 0 9 2 11
                                  0 10 10 12 1 6 0 11 13 0 14 0 15 2 17
                                  0 16 0 18 1 14 0 10 19 2 14 0 0 0 20
                                  1 21 11 10 22 1 14 0 11 23 2 14 0 0 0
                                  24 1 6 0 14 25 2 6 0 0 0 26 2 6 0 0 0
                                  27 1 6 0 0 28 0 6 0 29 2 6 0 14 0 30
                                  1 14 0 0 31 1 6 0 0 32 1 6 0 10 33 1
                                  14 0 0 34 1 14 0 0 35 0 14 16 36 2 16
                                  37 0 0 38 0 14 16 39 1 6 14 0 40 2 14
                                  0 0 10 41 2 14 37 0 0 42 1 43 37 14
                                  44 1 14 16 16 45 1 6 0 0 47 1 6 0 0
                                  48 2 14 0 16 0 49 0 14 0 50 1 14 10 0
                                  51 2 14 0 0 0 52 0 14 0 53 2 14 0 0 0
                                  54 1 14 10 0 55 2 10 0 16 0 56 1 6 14
                                  0 57 0 14 0 58 1 14 0 0 59 0 6 0 60 0
                                  6 0 63 0 14 0 64 1 0 6 6 61 1 0 14 14
                                  65 1 0 6 6 46 1 0 14 14 62)))))
          '|lookupComplete|)) 

(MAKEPROP '|FloatSpecialFunctions| 'NILADIC T) 
