;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; LUSH Lisp Universal Shell
;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
;;; Includes parts of TL3:
;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
;;; Includes selected parts of SN3.2:
;;;   Copyright (C) 1991-2001 AT&T Corp.
;;;
;;; Includes information derived from the GSL (Gnu Scientific Library)
;;;   header files which are copyrighted and distributed under the GPL
;;;   by their respective authors.
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(libload "gsl/gsl-config")



#? *** sys

;; dummy function that adds GSL C header files in C file
(eval `(de dummy_sys () ,gsl-cpheader-cmd ()))

#? * (dummy_sys)
#? * (gsl_log1p <x>)
#? * (gsl_expm1 <x>)
#? * (gsl_hypot <x> <y>)
#? * (gsl_acosh <x>)
#? * (gsl_asinh <x>)
#? * (gsl_atanh <x>)
#? * (gsl_isnan <x>)
#? * (gsl_isinf <x>)
#? * (gsl_finite <x>)
#? * (gsl_nan)
#? * (gsl_posinf)
#? * (gsl_neginf)
#? * (gsl_fdiv <x> <y>)
#? * (gsl_coerce_double <x>)
#? * (gsl_coerce_float <x>)
#? * (gsl_coerce_long_double <x>)

;; ********************************************************



(de gsl_log1p (    x )
    ((-double-) x) 
    (double #{ gsl_log1p (  $x) #} )
)

(de gsl_expm1 (    x )
    ((-double-) x) 
    (double #{ gsl_expm1 (  $x) #} )
)

(de gsl_hypot (    x  y )
    ((-double-) x) 
    ((-double-) y) 
    (double #{ gsl_hypot (  $x ,$y) #} )
)

(de gsl_acosh (    x )
    ((-double-) x) 
    (double #{ gsl_acosh (  $x) #} )
)

(de gsl_asinh (    x )
    ((-double-) x) 
    (double #{ gsl_asinh (  $x) #} )
)

(de gsl_atanh (    x )
    ((-double-) x) 
    (double #{ gsl_atanh (  $x) #} )
)


(de gsl_isnan (    x )
    ((-double-) x) 
    (int #{ gsl_isnan (  $x) #} )
)

(de gsl_isinf (    x )
    ((-double-) x) 
    (int #{ gsl_isinf (  $x) #} )
)

(de gsl_finite (    x )
    ((-double-) x) 
    (int #{ gsl_finite (  $x) #} )
)


(de gsl_nan ( )
    (double #{ gsl_nan () #} )
)

(de gsl_posinf ( )
    (double #{ gsl_posinf () #} )
)

(de gsl_neginf ( )
    (double #{ gsl_neginf () #} )
)

(de gsl_fdiv (    x  y )
    ((-double-) x) 
    ((-double-) y) 
    (double #{ gsl_fdiv (  $x ,$y) #} )
)


(de gsl_coerce_double (    x )
    ((-double-) x) 
    (double #{ gsl_coerce_double (  $x) #} )
)

(de gsl_coerce_float (    x )
    ((-double-) x)                            ;; float -> double
    (double #{ gsl_coerce_float (  $x) #} )
)

(de gsl_coerce_long_double (    x )
    ((-double-) x)                                      ;; long double -> double
    (double #{ gsl_coerce_long_double (  $x) #} )        ;; long double -> double
)

;; ********************************************************

(dhc-make ()
  dummy_sys
  gsl_log1p
  gsl_expm1
  gsl_hypot
  gsl_acosh
  gsl_asinh
  gsl_atanh
  gsl_isnan
  gsl_isinf
  gsl_finite
  gsl_nan
  gsl_posinf
  gsl_neginf
  gsl_fdiv
  gsl_coerce_double
  gsl_coerce_float
  gsl_coerce_long_double
)
