cl_N log(const cl_N& a, const cl_N& b) returns zero when an exact negative integer is expected
Richard B. Kreckel
kreckel at thep.physik.uni-mainz.de
Fri Jun 18 23:37:12 CEST 2004
Hi Niklas!
On Fri, 18 Jun 2004, Niklas Knutsson wrote:
> the following bug required a workaround when writing source code for
> Qalculate!:
>
> cl_N log(const cl_N& a, const cl_N& b) returns zero when an exact
> negative integer is expected.
>
> example:
>
> log(recip(cl_RA(1000)), cl_N(10)); returns 0
> log(cl_N(0.001), cl_N(10)); returns -3
>
> using
> cln-1.1.6
> gmp-4.1.2
> gcc-3.3.3
> glibc-2.3.3_pre20040207
> linux-2.6.5-mm1
>
> //niklas k.
Thank you very much for your bugreport.
I have fixed it in CVS. It turns out to be a one-character fix:
Index: src/rational/transcendental/cl_RA_logp.cc
===================================================================
RCS file: /home/cvs/cln/src/rational/transcendental/cl_RA_logp.cc,v
retrieving revision 1.2
diff -a -u -r1.2 cl_RA_logp.cc
--- src/rational/transcendental/cl_RA_logp.cc 28 Aug 2000 22:08:23 -0000 1.2
+++ src/rational/transcendental/cl_RA_logp.cc 18 Jun 2004 21:33:23 -0000
@@ -50,7 +50,7 @@
return cl_false;
// a1=1
var cl_RA l;
- if (logp(a2,b,pl)) {
+ if (logp(a2,b,&l)) {
*pl = -l; return cl_true;
} else
return cl_false;
Regards
-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>
More information about the GiNaC-devel
mailing list