Commit 3425a1f6 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Add checks for these. supply right version of above. Use everywhere.

2002-02-25  Morten Welinder  <terra@diku.dk>

	* configure.in (atan2l, sinhl, coshl, tanhl, asinhl, acoshl,
	atanhl, erfl, erfcl, ynl, isnanl, finitel, hypotl): Add checks for these.
	* src/numbers.h: supply right version of above.  Use everywhere.
parent 62b46ab8
2002-02-25 Morten Welinder <terra@diku.dk>
* configure.in (atan2l, sinhl, coshl, tanhl, asinhl, acoshl,
atanhl, erfl, erfcl, ynl, isnanl, finitel, hypotl): Add checks for these.
* src/numbers.h: supply right version of above. Use everywhere.
2002-02-25 Jon K Hellan <hellan@acm.org>
* src/sheet-object-image.h: Declare typedef ObjectImage.
......
2002-02-25 Morten Welinder <terra@diku.dk>
* configure.in (atan2l, sinhl, coshl, tanhl, asinhl, acoshl,
atanhl, erfl, erfcl, ynl, isnanl, finitel, hypotl): Add checks for these.
* src/numbers.h: supply right version of above. Use everywhere.
2002-02-25 Jon K Hellan <hellan@acm.org>
* src/sheet-object-image.h: Declare typedef ObjectImage.
......
2002-02-25 Morten Welinder <terra@diku.dk>
* configure.in (atan2l, sinhl, coshl, tanhl, asinhl, acoshl,
atanhl, erfl, erfcl, ynl, isnanl, finitel, hypotl): Add checks for these.
* src/numbers.h: supply right version of above. Use everywhere.
2002-02-25 Jon K Hellan <hellan@acm.org>
* src/sheet-object-image.h: Declare typedef ObjectImage.
......
......@@ -44,7 +44,7 @@ AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource)
## this should come after `AC_PROG_CC'
GNOME_COMPILE_WARNINGS
set_mode_warnings=yes
set_more_warnings=yes
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
for option in -Wsign-promo -Wsign-compare -Wpointer-arith -Wnested-externs -Wchar-subscripts -Wwrite-strings; do
SAVE_CFLAGS="$CFLAGS"
......@@ -74,7 +74,10 @@ AC_ARG_WITH(long_double,
fi
need_sunmath=no
for ldfunc in fabsl sqrtl expl logl log10l ceill floorl powl sinl cosl tanl asinl acosl atanl; do
for ldfunc in fabsl sqrtl expl logl log10l ceill floorl powl hypotl \
sinl cosl tanl asinl acosl atanl atan2l \
sinhl coshl tanhl asinhl acoshl atanhl \
erfl erfcl ynl isnanl finitel; do
AC_CHECK_FUNC($ldfunc,
,
AC_CHECK_LIB(m,
......
......@@ -535,7 +535,7 @@ gnumeric_bessely (FunctionEvalInfo *ei, Value **argv)
if ((y = value_get_as_int (argv[1])) < 0)
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (yn (y, value_get_as_float (argv[0])));
return value_new_float (yngnum (y, value_get_as_float (argv[0])));
}
/* Converts a complex number string into its coefficients. Returns 0 if ok,
......@@ -1631,14 +1631,14 @@ static const char *help_erf = {
static Value *
gnumeric_erf (FunctionEvalInfo *ei, Value **argv)
{
gnum_float ans, lower, upper=0.0;
gnum_float ans, lower, upper;
lower = value_get_as_float (argv[0]);
ans = erf(lower);
ans = erfgnum (lower);
if (argv[1]) {
upper = value_get_as_float (argv[1]);
ans = erf (upper) - ans;
ans = erfgnum (upper) - ans;
}
return value_new_float (ans);
......@@ -1671,7 +1671,7 @@ gnumeric_erfc (FunctionEvalInfo *ei, Value **argv)
x = value_get_as_float (argv[0]);
return value_new_float (erfc (x));
return value_new_float (erfcgnum (x));
}
/***************************************************************************/
......
......@@ -306,7 +306,7 @@ gnumeric_acosh (FunctionEvalInfo *ei, Value **args)
if (t < 1.0)
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (acosh (t));
return value_new_float (acoshgnum (t));
}
/***************************************************************************/
......@@ -361,7 +361,7 @@ static const char *help_asinh = {
static Value *
gnumeric_asinh (FunctionEvalInfo *ei, Value **args)
{
return value_new_float (asinh (value_get_as_float (args [0])));
return value_new_float (asinhgnum (value_get_as_float (args [0])));
}
/***************************************************************************/
......@@ -418,7 +418,7 @@ gnumeric_atanh (FunctionEvalInfo *ei, Value **args)
if ((t <= -1.0) || (t >= 1.0))
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (atanh (value_get_as_float (args [0])));
return value_new_float (atanhgnum (value_get_as_float (args [0])));
}
/***************************************************************************/
......@@ -445,7 +445,7 @@ static const char *help_atan2 = {
static Value *
gnumeric_atan2 (FunctionEvalInfo *ei, Value **args)
{
return value_new_float (atan2 (value_get_as_float (args [1]),
return value_new_float (atan2gnum (value_get_as_float (args [1]),
value_get_as_float (args [0])));
}
......@@ -791,7 +791,7 @@ static const char *help_cosh = {
static Value *
gnumeric_cosh (FunctionEvalInfo *ei, Value **argv)
{
return value_new_float (cosh (value_get_as_float (argv [0])));
return value_new_float (coshgnum (value_get_as_float (argv [0])));
}
/***************************************************************************/
......@@ -1410,7 +1410,7 @@ static const char *help_sinh = {
static Value *
gnumeric_sinh (FunctionEvalInfo *ei, Value **argv)
{
return value_new_float (sinh (value_get_as_float (argv [0])));
return value_new_float (sinhgnum (value_get_as_float (argv [0])));
}
/***************************************************************************/
......@@ -1671,7 +1671,7 @@ static const char *help_tanh = {
static Value *
gnumeric_tanh (FunctionEvalInfo *ei, Value **argv)
{
return value_new_float (tanh (value_get_as_float (argv [0])));
return value_new_float (tanhgnum (value_get_as_float (argv [0])));
}
/***************************************************************************/
......
......@@ -81,7 +81,7 @@ GNUMERIC_COMPLEX_PROTO (int complex_zero_p (const complex_t *src))
GNUMERIC_COMPLEX_PROTO (gnum_float complex_mod (const complex_t *src))
#ifdef GNUMERIC_COMPLEX_BODY
{
return hypot (src->re, src->im);
return hypotgnum (src->re, src->im);
}
#endif
......@@ -90,7 +90,7 @@ GNUMERIC_COMPLEX_PROTO (gnum_float complex_mod (const complex_t *src))
GNUMERIC_COMPLEX_PROTO (gnum_float complex_angle (const complex_t *src))
#ifdef GNUMERIC_COMPLEX_BODY
{
return atan2 (src->im, src->re);
return atan2gnum (src->im, src->re);
}
#endif
......@@ -211,8 +211,8 @@ GNUMERIC_COMPLEX_PROTO (void complex_sin (complex_t *dst, const complex_t *src))
#ifdef GNUMERIC_COMPLEX_BODY
{
complex_init (dst,
singnum (src->re) * cosh (src->im),
cosgnum (src->re) * sinh (src->im));
singnum (src->re) * coshgnum (src->im),
cosgnum (src->re) * sinhgnum (src->im));
}
#endif
......@@ -222,8 +222,8 @@ GNUMERIC_COMPLEX_PROTO (void complex_cos (complex_t *dst, const complex_t *src))
#ifdef GNUMERIC_COMPLEX_BODY
{
complex_init (dst,
cosgnum (src->re) * cosh (src->im),
-singnum (src->re) * sinh (src->im));
cosgnum (src->re) * coshgnum (src->im),
-singnum (src->re) * sinhgnum (src->im));
}
#endif
......
......@@ -31,9 +31,6 @@
#include <libgnome/gnome-i18n.h>
#include <math.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#define MAX_CELL_NAME_LEN 20
#define GOALSEEK_KEY "goal-seek-dialog"
......@@ -95,7 +92,7 @@ goal_seek_eval (gnum_float x, gnum_float *y, void *vevaldata)
if (evaldata->ycell->value) {
*y = value_get_as_float (evaldata->ycell->value) - evaldata->ytarget;
if (FINITE (*y))
if (finitegnum (*y))
return GOAL_SEEK_OK;
}
......
......@@ -47,9 +47,6 @@
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif
#ifdef HAVE_IEEEFP_H
# include <ieeefp.h>
#endif
/***************************************************************************/
......@@ -1559,7 +1556,7 @@ format_value (StyleFormat const *format, Value const *value, StyleColor **color,
v = format_number (value->v_int.val, (int)col_width, entry);
break;
case VALUE_FLOAT:
if (!FINITE (value->v_float.val))
if (!finitegnum (value->v_float.val))
return g_strdup (gnumeric_err_VALUE);
if (entry == NULL) {
......
......@@ -535,7 +535,7 @@ gnumeric_bessely (FunctionEvalInfo *ei, Value **argv)
if ((y = value_get_as_int (argv[1])) < 0)
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (yn (y, value_get_as_float (argv[0])));
return value_new_float (yngnum (y, value_get_as_float (argv[0])));
}
/* Converts a complex number string into its coefficients. Returns 0 if ok,
......@@ -1631,14 +1631,14 @@ static const char *help_erf = {
static Value *
gnumeric_erf (FunctionEvalInfo *ei, Value **argv)
{
gnum_float ans, lower, upper=0.0;
gnum_float ans, lower, upper;
lower = value_get_as_float (argv[0]);
ans = erf(lower);
ans = erfgnum (lower);
if (argv[1]) {
upper = value_get_as_float (argv[1]);
ans = erf (upper) - ans;
ans = erfgnum (upper) - ans;
}
return value_new_float (ans);
......@@ -1671,7 +1671,7 @@ gnumeric_erfc (FunctionEvalInfo *ei, Value **argv)
x = value_get_as_float (argv[0]);
return value_new_float (erfc (x));
return value_new_float (erfcgnum (x));
}
/***************************************************************************/
......
......@@ -306,7 +306,7 @@ gnumeric_acosh (FunctionEvalInfo *ei, Value **args)
if (t < 1.0)
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (acosh (t));
return value_new_float (acoshgnum (t));
}
/***************************************************************************/
......@@ -361,7 +361,7 @@ static const char *help_asinh = {
static Value *
gnumeric_asinh (FunctionEvalInfo *ei, Value **args)
{
return value_new_float (asinh (value_get_as_float (args [0])));
return value_new_float (asinhgnum (value_get_as_float (args [0])));
}
/***************************************************************************/
......@@ -418,7 +418,7 @@ gnumeric_atanh (FunctionEvalInfo *ei, Value **args)
if ((t <= -1.0) || (t >= 1.0))
return value_new_error (ei->pos, gnumeric_err_NUM);
return value_new_float (atanh (value_get_as_float (args [0])));
return value_new_float (atanhgnum (value_get_as_float (args [0])));
}
/***************************************************************************/
......@@ -445,7 +445,7 @@ static const char *help_atan2 = {
static Value *
gnumeric_atan2 (FunctionEvalInfo *ei, Value **args)
{
return value_new_float (atan2 (value_get_as_float (args [1]),
return value_new_float (atan2gnum (value_get_as_float (args [1]),
value_get_as_float (args [0])));
}
......@@ -791,7 +791,7 @@ static const char *help_cosh = {
static Value *
gnumeric_cosh (FunctionEvalInfo *ei, Value **argv)
{
return value_new_float (cosh (value_get_as_float (argv [0])));
return value_new_float (coshgnum (value_get_as_float (argv [0])));
}
/***************************************************************************/
......@@ -1410,7 +1410,7 @@ static const char *help_sinh = {
static Value *
gnumeric_sinh (FunctionEvalInfo *ei, Value **argv)
{
return value_new_float (sinh (value_get_as_float (argv [0])));
return value_new_float (sinhgnum (value_get_as_float (argv [0])));
}
/***************************************************************************/
......@@ -1671,7 +1671,7 @@ static const char *help_tanh = {
static Value *
gnumeric_tanh (FunctionEvalInfo *ei, Value **argv)
{
return value_new_float (tanh (value_get_as_float (argv [0])));
return value_new_float (tanhgnum (value_get_as_float (argv [0])));
}
/***************************************************************************/
......
......@@ -629,11 +629,11 @@ strtognum (const char *str, char **end)
gnum_float
ldexpgnum (gnum_float x, int exp)
{
if (!FINITE (x) || x == 0)
if (!finitegnum (x) || x == 0)
return x;
else {
gnum_float res = x * gpow2 (exp);
if (FINITE (res))
if (finitegnum (res))
return res;
else {
errno = ERANGE;
......@@ -660,7 +660,7 @@ frexpgnum (gnum_float x, int *exp)
/* This might underflow or overflow in the cast. */
dbl_res = frexp ((double)x, exp);
if (!FINITE (x) || x == 0)
if (!finitegnum (x) || x == 0)
return dbl_res;
/*
......
......@@ -48,6 +48,7 @@ gnum_float frexpgnum (gnum_float x, int *exp);
#define floorgnum floorl
#define ceilgnum ceill
#define powgnum powl
#define hypotgnum hypotl
#define expgnum expl
#define loggnum logl
#define log10gnum log10l
......@@ -57,6 +58,18 @@ gnum_float frexpgnum (gnum_float x, int *exp);
#define asingnum asinl
#define acosgnum acosl
#define atangnum atanl
#define atan2gnum atan2l
#define erfgnum erfl
#define erfcgnum erfcl
#define yngnum ynl
#define isnangnum isnanl
#define finitegnum finitel
#define sinhgnum sinhl
#define coshgnum coshl
#define tanhgnum tanhl
#define asinhgnum asinhl
#define acoshgnum acoshl
#define atanhgnum atanhl
#define GNUM_FORMAT_e "Le"
#define GNUM_FORMAT_E "LE"
......@@ -81,6 +94,7 @@ typedef double gnum_float;
#define floorgnum floor
#define ceilgnum ceil
#define powgnum pow
#define hypotgnum hypot
#define expgnum exp
#define loggnum log
#define log10gnum log10
......@@ -90,6 +104,18 @@ typedef double gnum_float;
#define asingnum asin
#define acosgnum acos
#define atangnum atan
#define atan2gnum atan2
#define erfgnum erf
#define erfcgnum erfc
#define yngnum yn
#define isnangnum isnan
#define finitegnum finite
#define sinhgnum sinh
#define coshgnum cosh
#define tanhgnum tanh
#define asinhgnum asinh
#define acoshgnum acosh
#define atanhgnum atanh
#define GNUM_FORMAT_e "e"
#define GNUM_FORMAT_E "E"
......
......@@ -55,7 +55,7 @@ value_new_int (int i)
Value *
value_new_float (gnum_float f)
{
if (FINITE (f)) {
if (finitegnum (f)) {
ValueFloat *v = g_new (ValueFloat, 1);
*((ValueType *)&(v->type)) = VALUE_FLOAT;
v->fmt = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment