Mercurial > hg > octave-lyh
comparison src/mappers.cc @ 1173:99fbb85d8152
[project @ 1995-03-21 14:49:52 by jwe]
author | jwe |
---|---|
date | Tue, 21 Mar 1995 14:49:52 +0000 |
parents | 42731861ee09 |
children | b6360f2d4fa6 |
comparison
equal
deleted
inserted
replaced
1172:f6cf5e07cbe5 | 1173:99fbb85d8152 |
---|---|
1 // mappers.cc -*- C++ -*- | 1 // mappers.cc -*- C++ -*- |
2 /* | 2 /* |
3 | 3 |
4 Copyright (C) 1992, 1993 John W. Eaton | 4 Copyright (C) 1992, 1993, 1995 John W. Eaton |
5 | 5 |
6 This file is part of Octave. | 6 This file is part of Octave. |
7 | 7 |
8 Octave is free software; you can redistribute it and/or modify it | 8 Octave is free software; you can redistribute it and/or modify it |
9 under the terms of the GNU General Public License as published by the | 9 under the terms of the GNU General Public License as published by the |
28 #include <math.h> | 28 #include <math.h> |
29 #include <float.h> | 29 #include <float.h> |
30 #include <Complex.h> | 30 #include <Complex.h> |
31 | 31 |
32 #include "missing-math.h" | 32 #include "missing-math.h" |
33 #include "f77-uscore.h" | |
33 #include "variables.h" | 34 #include "variables.h" |
34 #include "mappers.h" | 35 #include "mappers.h" |
35 #include "error.h" | 36 #include "error.h" |
36 #include "utils.h" | 37 #include "utils.h" |
37 #include "defun.h" | 38 #include "defun.h" |
38 | 39 |
39 #if defined (_AIX) && defined (__GNUG__) | 40 #if defined (_AIX) && defined (__GNUG__) |
40 #undef finite | 41 #undef finite |
41 #define finite(x) ((x) < DBL_MAX && (x) > -DBL_MAX) | 42 #define finite(x) ((x) < DBL_MAX && (x) > -DBL_MAX) |
42 #endif | 43 #endif |
44 | |
45 extern "C" | |
46 { | |
47 double F77_FCN (dgamma) (double*); | |
48 int F77_FCN (dlgams) (double*, double*, double*); | |
49 } | |
43 | 50 |
44 #ifndef M_LOG10E | 51 #ifndef M_LOG10E |
45 #define M_LOG10E 0.43429448190325182765 | 52 #define M_LOG10E 0.43429448190325182765 |
46 #endif | 53 #endif |
47 | 54 |
150 } | 157 } |
151 | 158 |
152 double | 159 double |
153 xgamma (double x) | 160 xgamma (double x) |
154 { | 161 { |
155 #if defined (HAVE_LGAMMA) | 162 return F77_FCN (dgamma) (&x); |
156 double y = lgamma (x); | |
157 return signgam * exp (y); | |
158 #else | |
159 error ("gamma(x) not available on this system"); | |
160 #endif | |
161 } | 163 } |
162 | 164 |
163 double | 165 double |
164 xisinf (double x) | 166 xisinf (double x) |
165 { | 167 { |
173 } | 175 } |
174 | 176 |
175 double | 177 double |
176 xlgamma (double x) | 178 xlgamma (double x) |
177 { | 179 { |
178 #if defined (HAVE_LGAMMA) | 180 double result; |
179 return lgamma (x); | 181 double sgngam; |
180 #else | 182 |
181 error ("lgamma (x) not available on this system"); | 183 F77_FCN (dlgams) (&x, &result, &sgngam); |
182 #endif | 184 |
185 return result; | |
183 } | 186 } |
184 | 187 |
185 // Complex -> double mappers. | 188 // Complex -> double mappers. |
186 | 189 |
187 double | 190 double |