Commit 9803021d authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Return a gnumeric_err_NUM if the number is invalid (NaN, Inf, ...). move

2001-12-21  Morten Welinder  <terra@diku.dk>

	* src/value.c (value_new_float): Return a gnumeric_err_NUM if the
	number is invalid (NaN, Inf, ...).
	* src/mathfunc.[ch]: move <ieeefp.h> include.
parent 3a1455b3
......@@ -31,6 +31,7 @@ Morten:
* Fix DATE.
* Fix a pile of leaks in financial functions.
* Fix COUPNCD, YIELD, PRICE.
* Fix overflow issues.
Wayne Schuller:
* Search and search-replace history persistence.
......
......@@ -23,7 +23,6 @@
#include <stdlib.h>
#include <float.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
/* Make sure we have this symbol defined, since the existance of the header
file implies it. */
#ifndef IEEE_754
......
......@@ -7,6 +7,9 @@
#ifndef FINITE
# if defined(HAVE_FINITE)
# ifdef HAVE_IEEEFP_H
# include <ieeefp.h>
# endif
# define FINITE finite
# elif defined(HAVE_ISFINITE)
# define FINITE isfinite
......
......@@ -15,6 +15,7 @@
#include "format.h"
#include "portability.h"
#include "str.h"
#include "mathfunc.h"
#include <stdlib.h>
#include <errno.h>
......@@ -51,10 +52,15 @@ value_new_int (int i)
Value *
value_new_float (gnum_float f)
{
ValueFloat *v = g_new (ValueFloat, 1);
*((ValueType *)&(v->type)) = VALUE_FLOAT;
v->val = f;
return (Value *)v;
if (FINITE (f)) {
ValueFloat *v = g_new (ValueFloat, 1);
*((ValueType *)&(v->type)) = VALUE_FLOAT;
v->val = f;
return (Value *)v;
} else {
/* FIXME: bogus ep sent here. What to do? */
return value_new_error (NULL, gnumeric_err_VALUE);
}
}
Value *
......
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