* device/include/math.h,
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 3 Apr 2007 12:21:50 +0000 (12:21 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 3 Apr 2007 12:21:50 +0000 (12:21 +0000)
* device/lib/cotf.c,
* device/lib/expf.c,
* device/lib/sincoshf.c: changed XMAX to C99 HUGE_VALF

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4733 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
device/include/math.h
device/lib/cotf.c
device/lib/expf.c
device/lib/sincoshf.c

index 3ef19fa896e3845caa959bc9f4b474deb096cb30..d16fe4fe1884413c1cdffb4d29351629fc0bd390 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-04-03 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * device/include/math.h,
+       * device/lib/cotf.c,
+       * device/lib/expf.c,
+       * device/lib/sincoshf.c: changed XMAX to C99 HUGE_VALF
+
 2007-04-01 Borut Razem <borut.razem AT siol.net>
 
        * src/SDCC.lex, src/SDCCmain.c, support/cpp2/sdcpp.c:
index fe56342333a41bb3b281f2c8a9429f1b24272a4e..de015c35b4bd23705d6c084f4d846aa8b34e3bc8 100644 (file)
@@ -1,6 +1,6 @@
 /*  math.h: Floating point math function declarations
 
-    Copyright (C) 2001  Jesus Calvino-Fraga, jesusc@ieee.org 
+    Copyright (C) 2001  Jesus Calvino-Fraga, jesusc@ieee.org
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,8 @@
 #ifndef _INC_MATH
 #define _INC_MATH
 
+#define HUGE_VALF   3.402823466e+38
+
 #define PI          3.1415926536
 #define TWO_PI      6.2831853071
 #define HALF_PI     1.5707963268
@@ -34,7 +36,6 @@
 // EPS=2**(-12).  Also define EPS2=EPS*EPS.
 #define EPS 244.14062E-6
 #define EPS2 59.6046E-9
-#define XMAX 3.402823466E+38
 
 union float_long
 {
index 03886c12304d492ba1aa085a9787111a7c903e62..9c5a9964656099e85bc65e5595db0c72f4b2c159 100644 (file)
@@ -1,6 +1,6 @@
 /*  cotf.c: Computes cot(x) where x is a 32-bit float.
 
-    Copyright (C) 2001, 2002  Jesus Calvino-Fraga, jesusc@ieee.org 
+    Copyright (C) 2001, 2002  Jesus Calvino-Fraga, jesusc@ieee.org
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -32,9 +32,9 @@ float cotf(const float x) _FLOAT_FUNC_REENTRANT
     {
         errno = ERANGE;
         if (x<0.0)
-            return -XMAX;
+            return -HUGE_VALF;
         else
-            return XMAX;
+            return +HUGE_VALF;
     }
     return tancotf(x, 1);
 }
index 922566aa9e13a50c9bac0ad69025d68ddd8650ea..7328100acad3dcc74cc4fbbec2ed04f8bbf0c6cc 100644 (file)
@@ -108,7 +108,7 @@ expf_range_ok:
        mov     r3,#0x39
        lcall   expf_scale_and_add
 expf_no_range_reduction:
-       
+
 
 // Compute e^x using the cordic algorithm.  This works over an
 // input range of 0 to 0.69314712.  Can be extended to work from
@@ -318,7 +318,7 @@ fs_lshift_done:
 #define C1       0.693359375
 #define C2      -2.1219444005469058277e-4
 
-#define BIGX    88.72283911  /* ln(XMAX) */
+#define BIGX    88.72283911  /* ln(HUGE_VALF) */
 #define EXPEPS  1.0E-7       /* exp(1.0E-7)=0.0000001 */
 #define K1      1.4426950409 /* 1/ln(2) */
 
@@ -340,7 +340,8 @@ float expf(const float x)
         if(sign)
         {
             errno=ERANGE;
-            return XMAX;
+            return HUGE_VALF
+            ;
         }
         else
         {
index 644baf6a5134e28d58317f34661cfd7aa145def5..c4e877b6ade0a344972c2826b5b00c6041211b58 100644 (file)
@@ -37,7 +37,7 @@
 #define K2 0.24999308500451499336E+0 /* v**(-2) */
 #define K3 0.13830277879601902638E-4 /* v/2-1   */
 
-//WMAX is defined as ln(XMAX)-ln(v)+0.69
+//WMAX is defined as ln(HUGE_VALF)-ln(v)+0.69
 #define WMAX 44.93535952E+0
 //WBAR 0.35*(b+1)
 #define WBAR 1.05
@@ -59,7 +59,7 @@ float sincoshf(const float x, const int iscosh)
             if (w>WMAX)
             {
                 errno=ERANGE;
-                z=XMAX;
+                z=HUGE_VALF;
             }
             else
             {