Hi Luis, You are correct, longlong(600851475143)%longlong(71) still fails. Sorry for not checking. I have a good idea on solving that… stand by.
Just wanted to make sure you don't spend time chasing a dead-end with this parentheses bit: pdl> p (600851475143)%(71) #WRONG and DIFFERENT from above 600851475143 Notice that the returned value is the first argument. What you wrote translated into roughly: pdl> print(600851475143)%(71) In general, if you're going to follow 'p', 'print' or any function with a (, you need a closing paren to match it. Apparently "p" in the debugger behaves differently. Derek > On Feb 16, 2015, at 6:54 PM, Luis Mochan <[email protected]> wrote: > > Dear Derek, > I downloaded and compiled the git version and I made the following > tests from the pdl-code directory > > mochan@em:~/Downloads/pdl-code$ ./pdl > ... > Loaded PDL v2.007 (supports bad values) #MY OLD PDL > ... > pdl> p longlong(10)%longlong(5) #WRONG result > 53870592 > pdl> q > > > mochan@em:~/Downloads/pdl-code$ ./pdl -Mblib > ... > Loaded PDL v2.00711 (supports bad values) #NEW VERSION > ... > pdl> p longlong(10)%longlong(5) #CORRECT result! > 0 > pdl> p 600851475143%71 #CORRECT result > 0 > pdl> p longlong(600851475143)%longlong(71) #still WRONG result > 609885356032 > pdl> p (600851475143)%(71) #WRONG and DIFFERENT from above > 600851475143 > > So it seems that the problem with longs is solved when using small > numbers, but it remains when using large numbers. Furthermore, I found > (accidentally) another situation which yields the wrong result: just > putting the numbers between parenthesis yields an erroneous result > which is different. > > In order to test if the problem is the loss of precission when reading > the large number, as suggested by Chris > (http://sourceforge.net/p/pdl/bugs/343/) > I built it by parts: > > pdl> p 600851475143%71 > 0 > pdl> p +(longlong(6008514)*100000+75143) > 600851475143 > pdl> p +(longlong(6008514)*100000+75143)%longlong(71) > 609885356032 > pdl> p +(longlong(6008514)*100000+75143)%71 > 609885356032 > > > The problem with the parenthesis seemed to be unrelated to pdl's, so I tried > it in the perl debugger: > > mochan@em:~/Downloads/pdl-code$ perl -d -e 'print Hi' > ... > main::(-e:1): print Hi > DB<1> p 600851475143%71 > 0 > DB<2> p (600851475143)%(71) > 0 > DB<3> q > > It seems the culprit is not my perl, as it yields the correct result with > or without parenthesis. > > In summary, part of the problem was corrected with your commit, but it > seems that other problems remain, and apparently they are not (only) > related to the conversion from floating point. > > Thanks and regards, > Luis > > > -- > > o > W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) > Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ > Apdo. Postal 48-3, 62251 | (*)/\/ \ > Cuernavaca, Morelos, México | [email protected] /\_/\__/ > GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB > > > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
