/usr/include/gwyddion/libgwyddion/gwymathfallback.h is in libgwyddion20-dev 2.50-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | /*
* $Id: gwymathfallback.h 20678 2017-12-18 18:26:55Z yeti-dn $
* Copyright (C) 2007-2016 David Necas (Yeti).
* E-mail: yeti@gwyddion.net.
*
* 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GWY_MATH_FALLBACK_H__
#define __GWY_MATH_FALLBACK_H__
#include <math.h>
#include <float.h>
#include <glib.h>
#include <gwyconfig.h>
G_BEGIN_DECLS
/* This is necessary to fool gtk-doc that ignores static inline functions */
#define _GWY_STATIC_INLINE static inline
_GWY_STATIC_INLINE double gwy_math_fallback_pow10(double x);
_GWY_STATIC_INLINE double gwy_math_fallback_cbrt (double x);
_GWY_STATIC_INLINE double gwy_math_fallback_hypot(double x, double y);
_GWY_STATIC_INLINE double gwy_math_fallback_acosh(double x);
_GWY_STATIC_INLINE double gwy_math_fallback_asinh(double x);
_GWY_STATIC_INLINE double gwy_math_fallback_atanh(double x);
_GWY_STATIC_INLINE int gwy_math_fallback_isinf(double x);
_GWY_STATIC_INLINE int gwy_math_fallback_isnan(double x);
#undef _GWY_STATIC_INLINE
/* The empty comments fix gtk-doc.
* See http://bugzilla.gnome.org/show_bug.cgi?id=481811
*/
static inline double
gwy_math_fallback_pow10(double x)
{
return /**/ pow(10.0, x);
}
static inline double
gwy_math_fallback_cbrt(double x)
{
return /**/ (x == 0.0
? 0.0
: ((x < 0.0) ? -pow(-x, 1.0/3.0) : pow(x, 1.0/3.0)));
}
static inline double
gwy_math_fallback_hypot(double x, double y)
{
return /**/ sqrt(x*x + y*y);
}
static inline double
gwy_math_fallback_acosh(double x)
{
return /**/ log(x + sqrt(x*x - 1.0));
}
static inline double
gwy_math_fallback_asinh(double x)
{
return /**/ log(x + sqrt(x*x + 1.0));
}
static inline double
gwy_math_fallback_atanh(double x)
{
return /**/ log((1.0 + x)/(1.0 - x));
}
static inline int
gwy_math_fallback_isinf(double x)
{
GDoubleIEEE754 /**/ dbl;
dbl.v_double = x;
return /**/ (dbl.mpn.biased_exponent == 0x7ff
&& !dbl.mpn.mantissa_high && !dbl.mpn.mantissa_low);
}
static inline int
gwy_math_fallback_isnan(double x)
{
GDoubleIEEE754 /**/ dbl;
dbl.v_double = x;
return /**/ (dbl.mpn.biased_exponent == 0x7ff
&& (dbl.mpn.mantissa_high || dbl.mpn.mantissa_low));
}
#ifndef GWY_MATH_NAMESPACE_CLEAN
#ifndef GWY_HAVE_POW10
#define pow10 gwy_math_fallback_pow10
#endif /* GWY_HAVE_POW10 */
#ifndef GWY_HAVE_CBRT
#define cbrt gwy_math_fallback_cbrt
#endif /* GWY_HAVE_CBRT */
#ifndef GWY_HAVE_HYPOT
#define hypot gwy_math_fallback_hypot
#endif /* GWY_HAVE_HYPOT */
#ifndef GWY_HAVE_ACOSH
#define acosh gwy_math_fallback_acosh
#endif /* GWY_HAVE_ACOSH */
#ifndef GWY_HAVE_ASINH
#define asinh gwy_math_fallback_asinh
#endif /* GWY_HAVE_ASINH */
#ifndef GWY_HAVE_ATANH
#define atanh gwy_math_fallback_atanh
#endif /* GWY_HAVE_ATANH */
#endif /* GWY_MATH_NAMESPACE_CLEAN */
/* GCC's fast math makes isinf no-op. Must use the fallback function.
* Gwyddion works with finite arithmetic, but we need to detect INFs upon
* file import and remove it. */
#if (defined(GWY_HAVE_ISINF) && !defined(__FAST_MATH__))
#define gwy_isinf isinf
#else
#define gwy_isinf gwy_math_fallback_isinf
#endif /* GWY_HAVE_ISINF */
/* GCC's fast math makes isnan no-op. Must use the fallback function.
* Gwyddion works with finite arithmetic, but we need to detect NaNs upon
* file import and remove it. */
#if (defined(GWY_HAVE_ISNAN) && !defined(__FAST_MATH__))
#define gwy_isnan isnan
#else
#define gwy_isnan gwy_math_fallback_isnan
#endif /* GWY_HAVE_ISNAN */
G_END_DECLS
#endif /* __GWY_MATH_FALLBACK_H__ */
/* vim: set cin et ts=4 sw=4 cino=>1s,e0,n0,f0,{0,}0,^0,\:1s,=0,g1s,h0,t0,+1s,c3,(0,u0 : */
|