|
|
1.1 ! root 1: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- ! 2: * ! 3: * ***** BEGIN LICENSE BLOCK ***** ! 4: * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ! 5: * ! 6: * The contents of this file are subject to the Mozilla Public License Version ! 7: * 1.1 (the "License"); you may not use this file except in compliance with ! 8: * the License. You may obtain a copy of the License at ! 9: * http://www.mozilla.org/MPL/ ! 10: * ! 11: * Software distributed under the License is distributed on an "AS IS" basis, ! 12: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ! 13: * for the specific language governing rights and limitations under the ! 14: * License. ! 15: * ! 16: * The Original Code is Mozilla Communicator client code, released ! 17: * March 31, 1998. ! 18: * ! 19: * The Initial Developer of the Original Code is ! 20: * Netscape Communications Corporation. ! 21: * Portions created by the Initial Developer are Copyright (C) 1998 ! 22: * the Initial Developer. All Rights Reserved. ! 23: * ! 24: * Contributor(s): ! 25: * IBM Corp. ! 26: * ! 27: * Alternatively, the contents of this file may be used under the terms of ! 28: * either of the GNU General Public License Version 2 or later (the "GPL"), ! 29: * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ! 30: * in which case the provisions of the GPL or the LGPL are applicable instead ! 31: * of those above. If you wish to allow use of your version of this file only ! 32: * under the terms of either the GPL or the LGPL, and not to allow others to ! 33: * use your version of this file under the terms of the MPL, indicate your ! 34: * decision by deleting the provisions above and replace them with the notice ! 35: * and other provisions required by the GPL or the LGPL. If you do not delete ! 36: * the provisions above, a recipient may use your version of this file under ! 37: * the terms of any one of the MPL, the GPL or the LGPL. ! 38: * ! 39: * ***** END LICENSE BLOCK ***** */ ! 40: ! 41: /* ! 42: * By default all math calls go to fdlibm. The defines for each platform ! 43: * remap the math calls to native routines. ! 44: */ ! 45: ! 46: #ifndef _LIBMATH_H ! 47: #define _LIBMATH_H ! 48: ! 49: #include <math.h> ! 50: #include "jsconfig.h" ! 51: ! 52: /* ! 53: * Define which platforms on which to use fdlibm. Not used ! 54: * by default since there can be problems with endian-ness and such. ! 55: */ ! 56: ! 57: #if defined(_WIN32) && !defined(__MWERKS__) ! 58: #define JS_USE_FDLIBM_MATH 1 ! 59: ! 60: #elif defined(SUNOS4) ! 61: #define JS_USE_FDLIBM_MATH 1 ! 62: ! 63: #elif defined(IRIX) ! 64: #define JS_USE_FDLIBM_MATH 1 ! 65: ! 66: #elif defined(SOLARIS) ! 67: #define JS_USE_FDLIBM_MATH 1 ! 68: ! 69: #elif defined(HPUX) ! 70: #define JS_USE_FDLIBM_MATH 1 ! 71: ! 72: #elif defined(linux) ! 73: #define JS_USE_FDLIBM_MATH 1 ! 74: ! 75: #elif defined(OSF1) ! 76: /* Want to use some fdlibm functions but fdlibm broken on OSF1/alpha. */ ! 77: #define JS_USE_FDLIBM_MATH 0 ! 78: ! 79: #elif defined(AIX) ! 80: #define JS_USE_FDLIBM_MATH 1 ! 81: ! 82: #else ! 83: #define JS_USE_FDLIBM_MATH 0 ! 84: #endif ! 85: ! 86: #if !JS_USE_FDLIBM_MATH ! 87: ! 88: /* ! 89: * Use system provided math routines. ! 90: */ ! 91: ! 92: #define fd_acos acos ! 93: #define fd_asin asin ! 94: #define fd_atan atan ! 95: #define fd_atan2 atan2 ! 96: #define fd_ceil ceil ! 97: #define fd_copysign copysign ! 98: #define fd_cos cos ! 99: #define fd_exp exp ! 100: #define fd_fabs fabs ! 101: #define fd_floor floor ! 102: #define fd_fmod fmod ! 103: #define fd_log log ! 104: #define fd_pow pow ! 105: #define fd_sin sin ! 106: #define fd_sqrt sqrt ! 107: #define fd_tan tan ! 108: ! 109: #else ! 110: ! 111: /* ! 112: * Use math routines in fdlibm. ! 113: */ ! 114: ! 115: #undef __P ! 116: #ifdef __STDC__ ! 117: #define __P(p) p ! 118: #else ! 119: #define __P(p) () ! 120: #endif ! 121: ! 122: #if defined _WIN32 || defined SUNOS4 ! 123: ! 124: #define fd_acos acos ! 125: #define fd_asin asin ! 126: #define fd_atan atan ! 127: #define fd_cos cos ! 128: #define fd_sin sin ! 129: #define fd_tan tan ! 130: #define fd_exp exp ! 131: #define fd_log log ! 132: #define fd_sqrt sqrt ! 133: #define fd_ceil ceil ! 134: #define fd_fabs fabs ! 135: #define fd_floor floor ! 136: #define fd_fmod fmod ! 137: ! 138: extern double fd_atan2 __P((double, double)); ! 139: extern double fd_copysign __P((double, double)); ! 140: extern double fd_pow __P((double, double)); ! 141: ! 142: #elif defined IRIX ! 143: ! 144: #define fd_acos acos ! 145: #define fd_asin asin ! 146: #define fd_atan atan ! 147: #define fd_exp exp ! 148: #define fd_log log ! 149: #define fd_log10 log10 ! 150: #define fd_sqrt sqrt ! 151: #define fd_fabs fabs ! 152: #define fd_floor floor ! 153: #define fd_fmod fmod ! 154: ! 155: extern double fd_cos __P((double)); ! 156: extern double fd_sin __P((double)); ! 157: extern double fd_tan __P((double)); ! 158: extern double fd_atan2 __P((double, double)); ! 159: extern double fd_pow __P((double, double)); ! 160: extern double fd_ceil __P((double)); ! 161: extern double fd_copysign __P((double, double)); ! 162: ! 163: #elif defined SOLARIS ! 164: ! 165: #define fd_atan atan ! 166: #define fd_cos cos ! 167: #define fd_sin sin ! 168: #define fd_tan tan ! 169: #define fd_exp exp ! 170: #define fd_sqrt sqrt ! 171: #define fd_ceil ceil ! 172: #define fd_fabs fabs ! 173: #define fd_floor floor ! 174: #define fd_fmod fmod ! 175: ! 176: extern double fd_acos __P((double)); ! 177: extern double fd_asin __P((double)); ! 178: extern double fd_log __P((double)); ! 179: extern double fd_atan2 __P((double, double)); ! 180: extern double fd_pow __P((double, double)); ! 181: extern double fd_copysign __P((double, double)); ! 182: ! 183: #elif defined HPUX ! 184: ! 185: #define fd_cos cos ! 186: #define fd_sin sin ! 187: #define fd_exp exp ! 188: #define fd_sqrt sqrt ! 189: #define fd_fabs fabs ! 190: #define fd_floor floor ! 191: #define fd_fmod fmod ! 192: ! 193: extern double fd_ceil __P((double)); ! 194: extern double fd_acos __P((double)); ! 195: extern double fd_log __P((double)); ! 196: extern double fd_atan2 __P((double, double)); ! 197: extern double fd_tan __P((double)); ! 198: extern double fd_pow __P((double, double)); ! 199: extern double fd_asin __P((double)); ! 200: extern double fd_atan __P((double)); ! 201: extern double fd_copysign __P((double, double)); ! 202: ! 203: #elif defined(linux) ! 204: ! 205: #define fd_atan atan ! 206: #define fd_atan2 atan2 ! 207: #define fd_ceil ceil ! 208: #define fd_cos cos ! 209: #define fd_fabs fabs ! 210: #define fd_floor floor ! 211: #define fd_fmod fmod ! 212: #define fd_sin sin ! 213: #define fd_sqrt sqrt ! 214: #define fd_tan tan ! 215: #define fd_copysign copysign ! 216: ! 217: extern double fd_asin __P((double)); ! 218: extern double fd_acos __P((double)); ! 219: extern double fd_exp __P((double)); ! 220: extern double fd_log __P((double)); ! 221: extern double fd_pow __P((double, double)); ! 222: ! 223: #elif defined(OSF1) ! 224: ! 225: #define fd_acos acos ! 226: #define fd_asin asin ! 227: #define fd_atan atan ! 228: #define fd_copysign copysign ! 229: #define fd_cos cos ! 230: #define fd_exp exp ! 231: #define fd_fabs fabs ! 232: #define fd_fmod fmod ! 233: #define fd_sin sin ! 234: #define fd_sqrt sqrt ! 235: #define fd_tan tan ! 236: ! 237: extern double fd_atan2 __P((double, double)); ! 238: extern double fd_ceil __P((double)); ! 239: extern double fd_floor __P((double)); ! 240: extern double fd_log __P((double)); ! 241: extern double fd_pow __P((double, double)); ! 242: ! 243: #elif defined(AIX) ! 244: ! 245: #define fd_acos acos ! 246: #define fd_asin asin ! 247: #define fd_atan2 atan2 ! 248: #define fd_copysign copysign ! 249: #define fd_cos cos ! 250: #define fd_exp exp ! 251: #define fd_fabs fabs ! 252: #define fd_floor floor ! 253: #define fd_fmod fmod ! 254: #define fd_log log ! 255: #define fd_sin sin ! 256: #define fd_sqrt sqrt ! 257: ! 258: extern double fd_atan __P((double)); ! 259: extern double fd_ceil __P((double)); ! 260: extern double fd_pow __P((double,double)); ! 261: extern double fd_tan __P((double)); ! 262: ! 263: #else /* other platform.. generic paranoid slow fdlibm */ ! 264: ! 265: extern double fd_acos __P((double)); ! 266: extern double fd_asin __P((double)); ! 267: extern double fd_atan __P((double)); ! 268: extern double fd_cos __P((double)); ! 269: extern double fd_sin __P((double)); ! 270: extern double fd_tan __P((double)); ! 271: ! 272: extern double fd_exp __P((double)); ! 273: extern double fd_log __P((double)); ! 274: extern double fd_sqrt __P((double)); ! 275: ! 276: extern double fd_ceil __P((double)); ! 277: extern double fd_fabs __P((double)); ! 278: extern double fd_floor __P((double)); ! 279: extern double fd_fmod __P((double, double)); ! 280: ! 281: extern double fd_atan2 __P((double, double)); ! 282: extern double fd_pow __P((double, double)); ! 283: extern double fd_copysign __P((double, double)); ! 284: ! 285: #endif ! 286: ! 287: #endif /* JS_USE_FDLIBM_MATH */ ! 288: ! 289: #endif /* _LIBMATH_H */ ! 290:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.