Commit 9635688a authored by Ariel Rios's avatar Ariel Rios Committed by Ariel Rios

The function fibonacci was corrected so it can always return numbers.

1999-12-07  Ariel Rios <jarios@usa.net>

	* functions.scm: The function fibonacci was corrected so it can always return numbers.

	* plugin.c: (scm_to_value) : Whenever VALUE type is a number we return a float.
	  This removes some gnumeric crashes due to the fact that scm int may be in some
	  cases bigger than C integers.
parent e92d9904
1999-12-07 Ariel Rios <jarios@usa.net>
* functions.scm: The function fibonacci was corrected so it can always return numbers.
* plugin.c: (scm_to_value) : Whenever VALUE type is a number we return a float.
This removes some gnumeric crashes due to the fact that scm int may be in some
cases bigger than C integers.
1999-12-05 Ariel Rios <jarios@usa.net>
* Makefile.am: Modified to include functions.scm
* gnumeric_startup.scm: We now load the scheme
functions from the new file functions.scm
* functions.scm: The guile functions and their
registration are now located in this file.
(=FIBO(num)): Added fibonacci formula.
1999-11-28 Jody Goldberg <jgoldberg@home.com>
* plugin.c (value_to_scm) : Fill in the missing enums.
......
......@@ -68,11 +68,8 @@ is greater than 0 and 0 if NUMBER is equal 0."
(if (<= n 2)
b
(fibof (- n 1) b (+ a b))))))
((lambda(n)
(if (>= n (expt 2 32))
(number->string n)
n))
(fibof n 1 1)) ))
(fibof n 1 1)))
......
......@@ -123,10 +123,14 @@ scm_to_value (SCM scm)
}
else if (SCM_NFALSEP(scm_number_p(scm)))
{
if (scm_integer_p(scm))
return value_new_int ((int)scm_num2int(scm));
else
return value_new_float ((float)scm_num2dbl(scm, 0));
/* We do not need to do any distinction between an integer or
* a float here. If we do so, we can crash gnumeric if the
* size of scm is bigger than the size of int
*/
//return value_new_int((int)scm_num2int(scm));
return value_new_float ((float)scm_num2dbl(scm, 0));
}
else if (SCM_NIMP(scm) && SCM_CONSP(scm))
{
......
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