I've started experimenting with CLN; I'm developing with Xcode 2 on Mac
OS X 10.4. The library and my code both build fine, but when I run my
test program, I get this:
[Session started at 2005-05-05 20:05:51
-0400.]
ZeroLink: unknown symbol '__ZN3cln15cl_class_fixnumE'
Euclid has exited due to signal 6 (SIGABRT).
Here's my code:
#include
<cln/integer.h>
#include <cln/real.h>
#include <cln/complex.h>
#include "cln_misc.h"
using
namespace
cln;
const
cl_I
fibonacci(
int);
const
cl_R gamma(cl_R);
const
cl_R gamma(cl_RA);
float_format_t iprec =
float_format(
500);
int
main() {
//
cl_I ret =
fibonacci(17);
return
0
;
}
// Returns F_n,
computed as the nearest integer to
// ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0.
const
cl_I fibonacci
(int
n)
{
// Need a
precision of ((1+sqrt(5))/2)^-n.
float_format_t prec =
float_format((
int)(
0.208987641
*n
+5
));
cl_R sqrt5 =
sqrt(cl_float(
5,prec));
cl_R phi =
(1
+sqrt5)/
2
;
return
round1( expt(phi,n)/sqrt5 );
}
const
cl_R gamma(cl_R src)
{
cl_R *ret
=
new
cl_R();
cl_R
deltax;
cl_R
x_k;
for
(int
i =
0
; i < iprec; i++)
{
x_k = x_k +
deltax;
*ret =
expt(ln(x_k), src);
}
*ret =
*ret * deltax;
return
*ret;
}
const
cl_R gamma(cl_RA src)
{
cl_R pass
= (cl_R)src;
return
gamma(pass);
}