Annotation of sbbs/include/mozilla/js/jslibmath.h, revision 1.1.1.2

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: /*
1.1.1.2 ! root       53:  * Define on which platforms to use fdlibm. Not used by default under
        !            54:  * assumption that native math library works unless proved guilty.
        !            55:  * Plus there can be problems with endian-ness and such in fdlibm itself.
        !            56:  *
        !            57:  * fdlibm compatibility notes:
        !            58:  * - fdlibm broken on OSF1/alpha
1.1       root       59:  */
                     60: 
1.1.1.2 ! root       61: #ifndef JS_USE_FDLIBM_MATH
1.1       root       62: #define JS_USE_FDLIBM_MATH 0
                     63: #endif
                     64: 
                     65: #if !JS_USE_FDLIBM_MATH
                     66: 
                     67: /*
                     68:  * Use system provided math routines.
                     69:  */
                     70: 
                     71: #define fd_acos acos
                     72: #define fd_asin asin
                     73: #define fd_atan atan
                     74: #define fd_atan2 atan2
                     75: #define fd_ceil ceil
1.1.1.2 ! root       76: 
        !            77: /* The right copysign function is not always named the same thing. */
        !            78: #if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
        !            79: #define fd_copysign __builtin_copysign
        !            80: #elif defined WINCE
        !            81: #define fd_copysign _copysign
        !            82: #elif defined _WIN32
        !            83: #if _MSC_VER < 1400
        !            84: /* Try to work around apparent _copysign bustage in VC6 and VC7. */
        !            85: #define fd_copysign js_copysign
        !            86: extern double js_copysign(double, double);
        !            87: #else
        !            88: #define fd_copysign _copysign
        !            89: #endif
        !            90: #else
1.1       root       91: #define fd_copysign copysign
1.1.1.2 ! root       92: #endif
        !            93: 
1.1       root       94: #define fd_cos cos
                     95: #define fd_exp exp
                     96: #define fd_fabs fabs
                     97: #define fd_floor floor
                     98: #define fd_fmod fmod
                     99: #define fd_log log
                    100: #define fd_pow pow
                    101: #define fd_sin sin
                    102: #define fd_sqrt sqrt
                    103: #define fd_tan tan
                    104: 
                    105: #else
                    106: 
                    107: /*
                    108:  * Use math routines in fdlibm.
                    109:  */
                    110: 
                    111: #undef __P
                    112: #ifdef __STDC__
                    113: #define __P(p)  p
                    114: #else
                    115: #define __P(p)  ()
                    116: #endif
                    117: 
1.1.1.2 ! root      118: #if (defined _WIN32 && !defined WINCE) || defined SUNOS4
1.1       root      119: 
                    120: #define fd_acos acos
                    121: #define fd_asin asin
                    122: #define fd_atan atan
                    123: #define fd_cos cos
                    124: #define fd_sin sin
                    125: #define fd_tan tan
                    126: #define fd_exp exp
                    127: #define fd_log log
                    128: #define fd_sqrt sqrt
                    129: #define fd_ceil ceil
                    130: #define fd_fabs fabs
                    131: #define fd_floor floor
                    132: #define fd_fmod fmod
                    133: 
                    134: extern double fd_atan2 __P((double, double));
                    135: extern double fd_copysign __P((double, double));
                    136: extern double fd_pow __P((double, double));
                    137: 
                    138: #elif defined IRIX
                    139: 
                    140: #define fd_acos acos
                    141: #define fd_asin asin
                    142: #define fd_atan atan
                    143: #define fd_exp exp
                    144: #define fd_log log
                    145: #define fd_log10 log10
                    146: #define fd_sqrt sqrt
                    147: #define fd_fabs fabs
                    148: #define fd_floor floor
                    149: #define fd_fmod fmod
                    150: 
                    151: extern double fd_cos __P((double));
                    152: extern double fd_sin __P((double));
                    153: extern double fd_tan __P((double));
                    154: extern double fd_atan2 __P((double, double));
                    155: extern double fd_pow __P((double, double));
                    156: extern double fd_ceil __P((double));
                    157: extern double fd_copysign __P((double, double));
                    158: 
                    159: #elif defined SOLARIS
                    160: 
                    161: #define fd_atan atan
                    162: #define fd_cos cos
                    163: #define fd_sin sin
                    164: #define fd_tan tan
                    165: #define fd_exp exp
                    166: #define fd_sqrt sqrt
                    167: #define fd_ceil ceil
                    168: #define fd_fabs fabs
                    169: #define fd_floor floor
                    170: #define fd_fmod fmod
                    171: 
                    172: extern double fd_acos __P((double));
                    173: extern double fd_asin __P((double));
                    174: extern double fd_log __P((double));
                    175: extern double fd_atan2 __P((double, double));
                    176: extern double fd_pow __P((double, double));
                    177: extern double fd_copysign __P((double, double));
                    178: 
                    179: #elif defined HPUX
                    180: 
                    181: #define fd_cos cos
                    182: #define fd_sin sin
                    183: #define fd_exp exp
                    184: #define fd_sqrt sqrt
                    185: #define fd_fabs fabs
                    186: #define fd_floor floor
                    187: #define fd_fmod fmod
                    188: 
                    189: extern double fd_ceil __P((double));
                    190: extern double fd_acos __P((double));
                    191: extern double fd_log __P((double));
                    192: extern double fd_atan2 __P((double, double));
                    193: extern double fd_tan __P((double));
                    194: extern double fd_pow __P((double, double));
                    195: extern double fd_asin __P((double));
                    196: extern double fd_atan __P((double));
                    197: extern double fd_copysign __P((double, double));
                    198: 
                    199: #elif defined(OSF1)
                    200: 
                    201: #define fd_acos acos
                    202: #define fd_asin asin
                    203: #define fd_atan atan
                    204: #define fd_copysign copysign
                    205: #define fd_cos cos
                    206: #define fd_exp exp
                    207: #define fd_fabs fabs
                    208: #define fd_fmod fmod
                    209: #define fd_sin sin
                    210: #define fd_sqrt sqrt
                    211: #define fd_tan tan
                    212: 
                    213: extern double fd_atan2 __P((double, double));
                    214: extern double fd_ceil __P((double));
                    215: extern double fd_floor __P((double));
                    216: extern double fd_log __P((double));
                    217: extern double fd_pow __P((double, double));
                    218: 
                    219: #elif defined(AIX)
                    220: 
                    221: #define fd_acos acos
                    222: #define fd_asin asin
                    223: #define fd_atan2 atan2
                    224: #define fd_copysign copysign
                    225: #define fd_cos cos
                    226: #define fd_exp exp
                    227: #define fd_fabs fabs
                    228: #define fd_floor floor
                    229: #define fd_fmod fmod
                    230: #define fd_log log
                    231: #define fd_sin sin
                    232: #define fd_sqrt sqrt
                    233: 
                    234: extern double fd_atan __P((double));
                    235: extern double fd_ceil __P((double));
                    236: extern double fd_pow __P((double,double));
                    237: extern double fd_tan __P((double));
                    238: 
                    239: #else /* other platform.. generic paranoid slow fdlibm */
                    240: 
                    241: extern double fd_acos __P((double));
                    242: extern double fd_asin __P((double));
                    243: extern double fd_atan __P((double));
                    244: extern double fd_cos __P((double));
                    245: extern double fd_sin __P((double));
                    246: extern double fd_tan __P((double));
1.1.1.2 ! root      247: 
1.1       root      248: extern double fd_exp __P((double));
                    249: extern double fd_log __P((double));
                    250: extern double fd_sqrt __P((double));
                    251: 
                    252: extern double fd_ceil __P((double));
                    253: extern double fd_fabs __P((double));
                    254: extern double fd_floor __P((double));
                    255: extern double fd_fmod __P((double, double));
                    256: 
                    257: extern double fd_atan2 __P((double, double));
                    258: extern double fd_pow __P((double, double));
                    259: extern double fd_copysign __P((double, double));
                    260: 
                    261: #endif
                    262: 
                    263: #endif /* JS_USE_FDLIBM_MATH */
                    264: 
                    265: #endif /* _LIBMATH_H */
                    266: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.