⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libm.h

📁 ecos为实时嵌入式操作系统
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef CYGONCE_PKGCONF_LIBM_H#define CYGONCE_PKGCONF_LIBM_H//========================================================================////      libm.h////      Configuration header for mathematical function library////========================================================================//####COPYRIGHTBEGIN####//// -------------------------------------------// The contents of this file are subject to the Cygnus eCos Public License// Version 1.0 (the "License"); you may not use this file except in// compliance with the License.  You may obtain a copy of the License at// http://sourceware.cygnus.com/ecos// // Software distributed under the License is distributed on an "AS IS"// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the// License for the specific language governing rights and limitations under// the License.// // The Original Code is eCos - Embedded Cygnus Operating System, released// September 30, 1998.// // The Initial Developer of the Original Code is Cygnus.  Portions created// by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions.  All Rights Reserved.// -------------------------------------------////####COPYRIGHTEND####//========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):   jlarmour// Contributors:  jlarmour// Date:        1998-02-13// Purpose:     Configuration of the standard mathematical function library// Description: Configuration header for mathematical function library// Usage:       #include <pkgconf/libm.h>////####DESCRIPTIONEND####////========================================================================//========================================================================//// A NOTE ON COMPATIBILITY MODES//// This math library is capable of being operated in several different// compatibility modes. These options deal solely with how errors are// handled.//// There are 4 compatibility modes: ANSI/POSIX 1003.1; IEEE-754; X/Open// Portability Guide issue 3 (XPG3); and System V Interface Definition// Edition 3.//// In IEEE mode, the matherr() function (see below) is never called, no// warning messages are printed on the stderr output stream, and errno is// never set.//// In ANSI/POSIX mode, errno is set correctly, but matherr() is never// called and no warning messages are printed on the stderr output stream.//// In X/Open mode, errno is set correctly, matherr() is called, but no// warning messages are printed on the stderr output stream.//// In SVID mode, functions which overflow return a value "HUGE" (defined in// math.h), which is the maximum single precision floating point value// (as opposed to HUGE_VAL which is meant to stand for infinity). errno is// set correctly and matherr() is called. If matherr() returns 0, warning// messages are printed on the stderr output stream for some errors.//// The mode can be compiled-in as IEEE-only, or any one of the above// methods settable at run-time. See the configuration options below for//  more.////========================================================================//// MATHERR()//// As said, in X/Open or SVID modes, the user can supply a function// matherr() of the form://// int matherr( struct exception * );//// where:// struct exception {//     int type;//     char *name;//     double arg1, arg2, retval;// };//// - type is the exception type and is one of:// DOMAIN    - argument domain exception// SING      - argument singularity// OVERFLOW  - overflow range exception// UNDERFLOW - underflow range exception// TLOSS     - total loss of significance// PLOSS     - partial loss of significance//// - name is a string containing the name of the function// - arg1 and arg2 are the arguments passed to the function// - retval is the default value that will be returned by the function, and//   can be changed by matherr// // matherr must have "C" linkage, not C++//// If matherr returns zero, or the user doesn't supply their own matherr,// then the following _usually_ happens in SVID mode:// // If type is://   DOMAIN    - 0.0 returned, errno=EDOM, and a message printed on stderr//   SING      - HUGE of appropriate sign is returned, errno=EDOM, and a//               message is printed on stderr//   OVERFLOW  - HUGE of appropriate sign is returned, and errno=ERANGE//   UNDERFLOW - 0.0 is returned and errno=ERANGE//   TLOSS     - 0.0 is returned, errno=ERANGE, and a message is printed on//               stderr//   PLOSS     - The current implementation doesn't return this type//// X/Open mode is similar except that the message is not printed on stderr// and HUGE_VAL is used in place of HUGE////========================================================================//// THREAD-SAFETY AND RE-ENTRANCY//// With the appropriate configuration options set below, the math library// is fully thread-safe if://// - Depending on the compatibility mode, the setting of the errno variable//   from the C library is thread-safe//// - Depending on the compatibility mode, sending error messages to the//   stderr output stream using the C library fputs() function is//   thread-safe//// - Depending on the compatibility mode, the user-supplied matherr()//   function and anything it depends on are thread-safe//// In addition, with the exception of the gamma*() and lgamma*() functions,// the math library is re-entrant (and thus safe to use from interrupt// handlers) if the Math library is always in IEEE mode////========================================================================//// Also note that this math library assumes the hardware (or software// floating point emulation) supports IEEE-754 style arithmetic, 32-bit// 2's complement integer arithmetic, doubles are in 64-bit// IEEE-754 format.////========================================================================// INCLUDES// Include system configuration file to work out whether the Math library// is to be included at all#include <pkgconf/system.h>// We want to check if the kernel supports per-thread data#ifdef CYGPKG_KERNEL# include <pkgconf/kernel.h>#endif/*    {{CFG_DATA        cdl_package CYGPKG_LIBM {            display      "Math library"            description  "ISO standard floating point mathematical library                          containing many useful functions for mathematical                          calculations."            type         boolean            requires     CYGPKG_ERROR            doc          ref/ecos-ref/the-iso-standard-c-and-math-libraries.html        }    }}CFG_DATA*/// TYPE DEFINITIONS// Compatibility mode selector - required for default belowtypedef enum {    CYGNUM_LIBM_COMPAT_UNINIT= 0,  // Default state. DO NOT set it to this    CYGNUM_LIBM_COMPAT_POSIX = 1,  // ANSI/POSIX 1003.1    CYGNUM_LIBM_COMPAT_IEEE  = 2,  // IEEE-754    CYGNUM_LIBM_COMPAT_XOPEN = 3,  // X/OPEN Portability guide issue 3                                   // (XPG3)    CYGNUM_LIBM_COMPAT_SVID  = 4   // System V Interface Definition 3rd                                   // edition} Cyg_libm_compat_t;//========================================================================//// COMPATIBILITY-MODE RELATED CONFIGURATION OPTIONS/*    {{CFG_DATA        cdl_component CYGPKG_LIBM_COMPATIBILITY {            display      "Compatibility mode"            description  "These options deal with behaviour related to                          the various compatibility modes - POSIX, IEEE,                          X/OPEN and SVID."            doc          ref/ecos-ref/math-library-compatibility-modes.html            type         dummy            parent       CYGPKG_LIBM        }        cdl_option CYGSEM_LIBM_COMPAT_IEEE_ONLY {            display      "IEEE-only"            description  "The math library can be hard-coded to only                          behave in one compatibility mode - IEEE. This                          cannot be changed at run-time. IEEE mode is the                          most minimal of the compatibility modes, and so

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -