[GiNaC-devel] Code for distinct degree factorization fails to compile.

Alexei Sheplyakov varg at theor.jinr.ru
Wed Nov 5 18:51:15 CET 2008


> > commit e989719ca767691eb75b34785baaaed716ea2624
> > Author: Jens Vollinga <jensv at balin.nikhef.nl>
> > Date:   Mon Nov 3 15:50:31 2008 +0100
> > 
> >     Added code for distinct degree factorization.
> 
> Thanks to stupid^W standard floating-integral conversions it fails to compile:
[snipped]

I've "fixed" it in the following way:

diff --git a/ginac/factor.cpp b/ginac/factor.cpp
index 19549a2..8ca39c3 100644
--- a/ginac/factor.cpp
+++ b/ginac/factor.cpp
@@ -900,7 +900,8 @@ static void distinct_degree_factor_BSGS(const umodpoly& a, upvec& result)
 
        int m = std::ceil(((double)n)/2/l);
        upvec H(m);
-       int ql = std::pow(q, l);
+       // XXX: what happens if we have an overflow here?
+       int ql = cl_I_to_int(expt_pos(cl_I(q), l));
        H[0] = h[l];
        for ( int i=1; i<m; ++i ) {
                expt_pos(H[i-1], ql, qk);


Best regards,
	Alexei

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-devel/attachments/20081105/c9e56ef9/attachment.sig 


More information about the GiNaC-devel mailing list