Package: pari
Version: 2.8
When passing a rational function that simplifies to a polynomial to the subst() function. I sometimes get a real number back (as expected and desired: see the *3 variables below in the Pari/GP session output), but sometimes get a polynomial returned (see the *2 variables below in the Pari/GP session output).

This is happening on a Windows 8 laptop with several different 2.8 builds of Pari/GP.

The session contents are below, followed by the contents of the script used and this script is also attached to this email.

I hope this information is useful. Please let me know if you need any further information.

Regards,

Paul


                                   GP/PARI CALCULATOR Version 2.8.0 (development 17322-7d69ad8)
                                    i686 running mingw (ix86/GMP-5.1.3 kernel) 32-bit version
                                         compiled: Jan  9 2015, gcc version 4.9.1 (GCC)
                                                     threading engine: single
                                          (readline v6.2 enabled, extended help enabled)

                                              Copyright (C) 2000-2014 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?13 for how to get moral (and possibly technical) support.

parisize = 4000000, primelimit = 500000
? \r bug-test-check.gp
? bug_check()

f1=1/w
f1 type=t_RFRAC

f2=w
f2 type=t_POL
vTemp2=2.3593040859717764207, type=t_POL
fVTemp2=2.3593040859717764207, type=t_POL


f3=w
f3 type=t_POL
vTemp3=2.3593040859717764207, type=t_REAL
fVTemp3=2, type=t_INT
f2-f3=0
?

=================

script contents:

bug_check()={
    my(f1,f2,f3,fVTemp2,fVTemp3,rt1,vTemp2,vTemp3);
    default(realprecision,20);
    rt1=2.3593040859717764207306603928005325553464812780676722837;
   
    f1=(w-2)/(w*w-2*w);
    print("\nf1=",f1);
    print("f1 type=",type(f1));

    f2=1/f1;
    print("\nf2=",f2);
    print("f2 type=",type(f2));
    vTemp2=subst(f2,w,rt1);
    fVTemp2=floor(vTemp2);
    print("vTemp2=",vTemp2,", type=",type(vTemp2));
    print("fVTemp2=",fVTemp2,", type=",type(fVTemp2),"\n");

    f3=(w*w-2*w)/(w-2);
    print("\nf3=",f3);
    print("f3 type=",type(f3));
    vTemp3=subst(f3,w,rt1);
    fVTemp3=floor(vTemp3);
    print("vTemp3=",vTemp3,", type=",type(vTemp3));
    print("fVTemp3=",fVTemp3,", type=",type(fVTemp3));
   
    print("f2-f3=",(f2-f3));
}