File indexing completed on 2024-12-22 04:17:20

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #ifndef KST_INF_H
0014 #define KST_INF_H
0015 
0016 #include <math.h>
0017 #include <float.h>
0018 #include <stdlib.h>
0019 #include <limits.h>
0020 
0021 #ifdef __sun
0022 #include <ieeefp.h>
0023 #endif
0024 
0025 #if !defined(INF)
0026 #include <qconfig.h>
0027 static double inf__()
0028 {
0029   /* work around some strict alignment requirements
0030      for double variables on some architectures (e.g. PA-RISC) */
0031   typedef union { unsigned char b[8]; double d; } kjs_double_t;
0032 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
0033   static const kjs_double_t Inf_Bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
0034 #elif defined(arm)
0035   static const kjs_double_t Inf_Bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } };
0036 #else
0037   static const kjs_double_t Inf_Bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
0038 #endif
0039 
0040   const double Inf = Inf_Bytes.d;
0041   return Inf;
0042 }
0043 #define INF (::inf__())
0044 #endif
0045 
0046 #endif // KST_INF_H