?? libm_support.h
字號:
/* file: libm_support.h *//*// Copyright (c) 2000 - 2004, Intel Corporation// All rights reserved.//// Contributed 2000 by the Intel Numerics Group, Intel Corporation//// Redistribution and use in source and binary forms, with or without// modification, are permitted provided that the following conditions are// met://// * Redistributions of source code must retain the above copyright// notice, this list of conditions and the following disclaimer.//// * Redistributions in binary form must reproduce the above copyright// notice, this list of conditions and the following disclaimer in the// documentation and/or other materials provided with the distribution.//// * The name of Intel Corporation may not be used to endorse or promote// products derived from this software without specific prior written// permission.//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.//// Intel Corporation is the author of this code, and requests that all// problem reports or change requests be submitted to it directly at// http://www.intel.com/software/products/opensource/libraries/num.htm.//// History: 02/02/2000 Initial version// 2/28/2000 added tags for logb and nextafter// 3/22/2000 Changes to support _LIB_VERSIONIMF variable// and filled some enum gaps. Added support for C99.// 5/31/2000 added prototypes for __libm_frexp_4l/8l// 8/10/2000 Changed declaration of _LIB_VERSIONIMF to work for library// builds and other application builds (precompiler directives).// 8/11/2000 Added pointers-to-matherr-functions declarations to allow// for user-defined matherr functions in the dll build.// 12/07/2000 Added scalbn error_types values.// 5/01/2001 Added error_types values for C99 nearest integer// functions.// 6/07/2001 Added error_types values for fdim.// 6/18/2001 Added include of complex_support.h.// 8/03/2001 Added error_types values for nexttoward, scalbln.// 8/23/2001 Corrected tag numbers from 186 and higher.// 8/27/2001 Added check for long int and long long int definitions.// 12/10/2001 Added error_types for erfc.// 12/27/2001 Added error_types for degree argument functions.// 01/02/2002 Added error_types for tand, cotd.// 01/04/2002 Delete include of complex_support.h// 01/23/2002 Deleted prototypes for __libm_frexp*. Added check for// multiple int, long int, and long long int definitions.// 05/20/2002 Added error_types for cot.// 06/27/2002 Added error_types for sinhcosh.// 12/05/2002 Added error_types for annuity and compound// 04/10/2003 Added error_types for tgammal/tgamma/tgammaf// 05/16/2003 FP-treatment macros copied here from IA32 libm_support.h// 06/02/2003 Added pad into struct fp80 (12/16 bytes).// 08/01/2003 Added struct ker80 and macros for multiprecision addition,// subtraction, multiplication, division, square root.// 08/07/2003 History section updated.// 09/03/2003 ALIGN(n) macro added.// 10/01/2003 LDOUBLE_ALIGN and fp80 corrected on linux to 16 bytes.// 11/24/2004 Added ifdef around definitions of INT32/64// 12/15/2004 Added error_types for exp10, nextafter, nexttoward// underflow. Moved error codes into libm_error_codes.h.//*/#ifndef __LIBM_SUPPORT_H_INCLUDED__#define __LIBM_SUPPORT_H_INCLUDED__#ifndef _LIBC#if !(defined(_WIN32) || defined(_WIN64))# pragma const_seg(".rodata") /* place constant data in text (code) section */#endif#if defined(__ICC) || defined(__ICL) || defined(__ECC) || defined(__ECL)# pragma warning( disable : 1682 ) /* #1682: ixplicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) */# pragma warning( disable : 1683 ) /* #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) */#endif#endif/* macros to form a double value in hex representation (unsigned int type) */#define DOUBLE_HEX(hi,lo) 0x##lo,0x##hi /*LITTLE_ENDIAN*/#include "libm_cpu_defs.h"#if !(defined (IA64))# include "libm_dll.h"# include "libm_dispatch.h"#endif#include "libm_error_codes.h"struct exceptionf{ int type; char *name; float arg1, arg2, retval;};# ifdef __cplusplusstruct __exception{ int type; char *name; double arg1, arg2, retval;};# else# ifndef _LIBCstruct exception{ int type; char *name; double arg1, arg2, retval;};# endif# endifstruct exceptionl{ int type; char *name; long double arg1, arg2, retval;};#if (defined (_MS_) && defined (IA64))#define MATHERR_F _matherrf#define MATHERR_D _matherr#else#define MATHERR_F matherrf#define MATHERR_D matherr#endif# ifdef __cplusplus#define EXC_DECL_D __exception#else// exception is a reserved name in C++#define EXC_DECL_D exception#endifextern int MATHERR_F(struct exceptionf*);extern int MATHERR_D(struct EXC_DECL_D*);extern int matherrl(struct exceptionl*);#ifndef _LIBC// Add code to support _LIB_VERSIONIMFtypedef enum{ _IEEE_ = -1, // IEEE-like behavior _SVID_, // SysV, Rel. 4 behavior _XOPEN_, // Unix98 _POSIX_, // Posix _ISOC_ // ISO C9X} _LIB_VERSION_TYPE;#endif// This is a run-time variable and may affect// floating point behavior of the libm functions#if !defined( LIBM_BUILD )#if defined( _DLL )extern _LIB_VERSION_TYPE __declspec(dllimport) _LIB_VERSIONIMF;#elseextern _LIB_VERSION_TYPE _LIB_VERSIONIMF;#endif /* _DLL */#elseextern int (*pmatherrf)(struct exceptionf*);extern int (*pmatherr)(struct EXC_DECL_D*);extern int (*pmatherrl)(struct exceptionl*);#endif /* LIBM_BUILD *//* memory format definitions (LITTLE_ENDIAN only) */#if !(defined(SIZE_INT_32) || defined(SIZE_INT_64))# error "You need to define SIZE_INT_32 or SIZE_INT_64"#endif#if (defined(SIZE_INT_32) && defined(SIZE_INT_64))#error multiple integer size definitions; define SIZE_INT_32 or SIZE_INT_64#endif#if !(defined(SIZE_LONG_32) || defined(SIZE_LONG_64))# error "You need to define SIZE_LONG_32 or SIZE_LONG_64"#endif#if (defined(SIZE_LONG_32) && defined(SIZE_LONG_64))#error multiple integer size definitions; define SIZE_LONG_32 or SIZE_LONG_64#endif#if !defined(__USE_EXTERNAL_FPMEMTYP_H__)#define BIAS_32 0x007F#define BIAS_64 0x03FF#define BIAS_80 0x3FFF#define MAXEXP_32 0x00FE#define MAXEXP_64 0x07FE#define MAXEXP_80 0x7FFE#define EXPINF_32 0x00FF#define EXPINF_64 0x07FF#define EXPINF_80 0x7FFFstruct fp32 { /*// sign:1 exponent:8 significand:23 (implied leading 1)*/#if defined(SIZE_INT_32) unsigned significand:23; unsigned exponent:8; unsigned sign:1;#elif defined(SIZE_INT_64) unsigned significand:23; unsigned exponent:8; unsigned sign:1;#endif};struct fp64 { /*/ sign:1 exponent:11 significand:52 (implied leading 1)*/#if defined(SIZE_INT_32) unsigned lo_significand:32; unsigned hi_significand:20; unsigned exponent:11; unsigned sign:1;#elif defined(SIZE_INT_64) unsigned significand:52; unsigned exponent:11; unsigned sign:1;#endif};struct fp80 { /*/ sign:1 exponent:15 significand:64 (NO implied bits) */#if defined(SIZE_INT_32) unsigned lo_significand; unsigned hi_significand; unsigned exponent:15; unsigned sign:1;#elif defined(SIZE_INT_64) unsigned significand; unsigned exponent:15; unsigned sign:1;#endif unsigned pad:16;#if !(defined(__unix__) && defined(__i386__)) unsigned padwin:32;#endif};#endif /*__USE_EXTERNAL_FPMEMTYP_H__*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -