Commit 5ef308be authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

use gnum_float, not double. Ditto. Ditto. (gnumeric_besseli): Ditto.

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

	* fn-math.c (gnumeric_randbetween): use gnum_float, not double.
	* fn-string.c (gnumeric_fixed): Ditto.
	* fn-eng.c (val_to_base): Ditto.
	(gnumeric_besseli): Ditto.
	(gnumeric_besselk): Ditto.
parent 3df5b5f0
......@@ -33,7 +33,7 @@ val_to_base (FunctionEvalInfo *ei, Value **argv, int num_argv,
int max, places;
char *err, buffer[40];
const char *str;
double v, b10;
gnum_float v, b10;
int digit;
g_return_val_if_fail (src_base > 1 && src_base <= 36,
......@@ -415,9 +415,7 @@ static char *help_besseli = {
static Value *
gnumeric_besseli (FunctionEvalInfo *ei, Value **argv)
{
double x;
double order;
double result;
gnum_float x, order;
x = value_get_as_float (argv[0]); /* value to evaluate I_n at. */
order = value_get_as_float (argv[1]); /* the order */
......@@ -425,8 +423,7 @@ gnumeric_besseli (FunctionEvalInfo *ei, Value **argv)
if (order < 0)
return value_new_error (ei->pos, gnumeric_err_NUM);
result = bessel_i (x, order, 1.0);
return value_new_float (result);
return value_new_float (bessel_i (x, order, 1.0));
}
/***************************************************************************/
......@@ -455,9 +452,7 @@ static char *help_besselk = {
static Value *
gnumeric_besselk (FunctionEvalInfo *ei, Value **argv)
{
double x;
double order;
double result;
gnum_float x, order;
x = value_get_as_float (argv[0]); /* value to evaluate K_n at. */
order = value_get_as_float (argv[1]); /* the order */
......@@ -465,8 +460,7 @@ gnumeric_besselk (FunctionEvalInfo *ei, Value **argv)
if (order < 0)
return value_new_error (ei->pos, gnumeric_err_NUM);
result = bessel_k (x, order, 1.0);
return value_new_float (result);
return value_new_float (bessel_k (x, order, 1.0));
}
/***************************************************************************/
......
......@@ -1966,7 +1966,7 @@ static Value *
gnumeric_randbetween (FunctionEvalInfo *ei, Value **argv)
{
int bottom, top;
double r;
gnum_float r;
bottom = value_get_as_int (argv[0]);
top = value_get_as_int (argv[1]);
......
......@@ -490,12 +490,12 @@ static char *help_fixed = {
static Value *
gnumeric_fixed (FunctionEvalInfo *ei, Value **argv)
{
int decimals;
gdouble num;
gboolean commas = TRUE;
int decimals;
gnum_float num;
gboolean commas = TRUE;
format_info_t fmt;
GString *str;
Value *res;
GString *str;
Value *res;
num = value_get_as_float (argv[0]);
decimals = argv[1] ? value_get_as_int (argv[1]) : 2;
......@@ -511,7 +511,7 @@ gnumeric_fixed (FunctionEvalInfo *ei, Value **argv)
if (decimals <= 0) {
/* no decimal point : just round and pad 0's */
double mult = gpow10 (decimals);
gnum_float mult = gpow10 (decimals);
num = (gnumeric_fake_round (num * mult) / mult);
fmt.right_req = fmt.right_allowed = 0;
} else /* decimal point format */
......
2002-02-19 Morten Welinder <terra@diku.dk>
* fn-math.c (gnumeric_randbetween): use gnum_float, not double.
* fn-string.c (gnumeric_fixed): Ditto.
* fn-eng.c (val_to_base): Ditto.
(gnumeric_besseli): Ditto.
(gnumeric_besselk): Ditto.
2002-02-18 Jody Goldberg <jody@gnome.org>
* Release 1.1.0
......
......@@ -33,7 +33,7 @@ val_to_base (FunctionEvalInfo *ei, Value **argv, int num_argv,
int max, places;
char *err, buffer[40];
const char *str;
double v, b10;
gnum_float v, b10;
int digit;
g_return_val_if_fail (src_base > 1 && src_base <= 36,
......@@ -415,9 +415,7 @@ static char *help_besseli = {
static Value *
gnumeric_besseli (FunctionEvalInfo *ei, Value **argv)
{
double x;
double order;
double result;
gnum_float x, order;
x = value_get_as_float (argv[0]); /* value to evaluate I_n at. */
order = value_get_as_float (argv[1]); /* the order */
......@@ -425,8 +423,7 @@ gnumeric_besseli (FunctionEvalInfo *ei, Value **argv)
if (order < 0)
return value_new_error (ei->pos, gnumeric_err_NUM);
result = bessel_i (x, order, 1.0);
return value_new_float (result);
return value_new_float (bessel_i (x, order, 1.0));
}
/***************************************************************************/
......@@ -455,9 +452,7 @@ static char *help_besselk = {
static Value *
gnumeric_besselk (FunctionEvalInfo *ei, Value **argv)
{
double x;
double order;
double result;
gnum_float x, order;
x = value_get_as_float (argv[0]); /* value to evaluate K_n at. */
order = value_get_as_float (argv[1]); /* the order */
......@@ -465,8 +460,7 @@ gnumeric_besselk (FunctionEvalInfo *ei, Value **argv)
if (order < 0)
return value_new_error (ei->pos, gnumeric_err_NUM);
result = bessel_k (x, order, 1.0);
return value_new_float (result);
return value_new_float (bessel_k (x, order, 1.0));
}
/***************************************************************************/
......
......@@ -1966,7 +1966,7 @@ static Value *
gnumeric_randbetween (FunctionEvalInfo *ei, Value **argv)
{
int bottom, top;
double r;
gnum_float r;
bottom = value_get_as_int (argv[0]);
top = value_get_as_int (argv[1]);
......
......@@ -490,12 +490,12 @@ static char *help_fixed = {
static Value *
gnumeric_fixed (FunctionEvalInfo *ei, Value **argv)
{
int decimals;
gdouble num;
gboolean commas = TRUE;
int decimals;
gnum_float num;
gboolean commas = TRUE;
format_info_t fmt;
GString *str;
Value *res;
GString *str;
Value *res;
num = value_get_as_float (argv[0]);
decimals = argv[1] ? value_get_as_int (argv[1]) : 2;
......@@ -511,7 +511,7 @@ gnumeric_fixed (FunctionEvalInfo *ei, Value **argv)
if (decimals <= 0) {
/* no decimal point : just round and pad 0's */
double mult = gpow10 (decimals);
gnum_float mult = gpow10 (decimals);
num = (gnumeric_fake_round (num * mult) / mult);
fmt.right_req = fmt.right_allowed = 0;
} else /* decimal point format */
......
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