?login_element?

Subversion Repositories NedoOS

Rev

Rev 835 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*  math.h: Floating point math function declarations
  2.  
  3.     Copyright (C) 2001  Jesus Calvino-Fraga, jesusc@ieee.org
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Lesser General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2.1 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Lesser General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Lesser General Public
  16.     License along with this library; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA */
  18.  
  19. /* Version 1.0 - Initial release */
  20.  
  21. #ifndef _INC_MATH
  22. #define _INC_MATH
  23.  
  24. #define HUGE_VALF   3.402823466e+38
  25.  
  26. #define PI          3.1415926536
  27. #define TWO_PI      6.2831853071
  28. #define HALF_PI     1.5707963268
  29. #define QUART_PI    0.7853981634
  30. #define iPI         0.3183098862
  31. #define iTWO_PI     0.1591549431
  32. #define TWO_O_PI    0.6366197724
  33.  
  34. /* EPS=B**(-t/2), where B is the radix of the floating-point representation
  35.    and there are t base-B digits in the significand.  Therefore, for floats
  36.    EPS=2**(-12).  Also define EPS2=EPS*EPS. */
  37. #define EPS 244.14062E-6
  38. #define EPS2 59.6046E-9
  39.  
  40. union float_long
  41. {
  42.     float f;
  43.     long l;
  44. };
  45.  
  46. #if defined(SDCC_MATH_LIB) && defined(SDCC_mcs51) && !defined(SDCC_USE_XSTACK) && !defined(SDCC_STACK_AUTO) && !defined(_SDCC_NO_ASM_LIB_FUNCS)
  47. /* Compile the mcs51 assembly version only when all these
  48.    conditions are met.  Since not all the functions are
  49.    reentrant, do not compile with --stack-auto is used. */
  50. #define MATH_ASM_MCS51
  51. #endif
  52.  
  53.  
  54. /* Functions on the z80 & gbz80 are always reentrant and so the "reentrant" */
  55. /* keyword is not defined. */
  56. //#if defined(SDCC_z80) || defined(SDCC_gbz80)
  57. #define _FLOAT_FUNC_REENTRANT
  58. //#else
  59. //#define _FLOAT_FUNC_REENTRANT __reentrant
  60. //#endif
  61.  
  62. /**********************************************
  63.  * Prototypes for float ANSI C math functions *
  64.  **********************************************/
  65.  
  66. /* Trigonometric functions */
  67. float sinf(const float x) _FLOAT_FUNC_REENTRANT;
  68. float cosf(const float x) _FLOAT_FUNC_REENTRANT;
  69. float tanf(const float x) _FLOAT_FUNC_REENTRANT;
  70. float cotf(const float x) _FLOAT_FUNC_REENTRANT;
  71. float asinf(const float x) _FLOAT_FUNC_REENTRANT;
  72. float acosf(const float x) _FLOAT_FUNC_REENTRANT;
  73. float atanf(const float x) _FLOAT_FUNC_REENTRANT;
  74. float atan2f(const float x, const float y);
  75.  
  76. /* Hyperbolic functions */
  77. float sinhf(const float x) _FLOAT_FUNC_REENTRANT;
  78. float coshf(const float x) _FLOAT_FUNC_REENTRANT;
  79. float tanhf(const float x) _FLOAT_FUNC_REENTRANT;
  80.  
  81. /* Exponential, logarithmic and power functions */
  82. float expf(const float x);
  83. float logf(const float x) _FLOAT_FUNC_REENTRANT;
  84. float log10f(const float x) _FLOAT_FUNC_REENTRANT;
  85. float powf(const float x, const float y);
  86. float sqrtf(const float a) _FLOAT_FUNC_REENTRANT;
  87.  
  88. /* Nearest integer, absolute value, and remainder functions */
  89. float fabsf(const float x) _FLOAT_FUNC_REENTRANT;
  90. float frexpf(const float x, int *pw2);
  91. float ldexpf(const float x, const int pw2);
  92. float ceilf(float x) _FLOAT_FUNC_REENTRANT;
  93. float floorf(float x) _FLOAT_FUNC_REENTRANT;
  94. float modff(float x, float * y);
  95.  
  96. #endif  /* _INC_MATH */
  97.