+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:
/* 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
#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
// 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
{
/* 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
{
errno = ERANGE;
if (x<0.0)
- return -XMAX;
+ return -HUGE_VALF;
else
- return XMAX;
+ return +HUGE_VALF;
}
return tancotf(x, 1);
}
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
#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) */
if(sign)
{
errno=ERANGE;
- return XMAX;
+ return HUGE_VALF
+ ;
}
else
{
#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
if (w>WMAX)
{
errno=ERANGE;
- z=XMAX;
+ z=HUGE_VALF;
}
else
{