Alan, Andrew: Thanks for finding/fixing these problems. > You were correct it was a problem with the Perl math library. The main > trouble I had in finding this was figuring out how to print out individual > elements of a pdl array. For future reference, this worked: > > for (my $i = 0; $i < int($windings)*int($steps)+1; $i++) { > printf("%f,%f,%f,%f\n", $phi->slice($i)->slice('(0)'), > $phiw->slice($i)->slice('(0)'), $xcoord->slice($i)->slice('(0)'), > $ycoord->slice($i)->slice('(0)')); > }
You can also do this: wcols $phi; --That will print out all 20,000 elements of $phi in a single column. Or this: print $phi->mslice([0,99]); That will print out the first 100 elements of $phi. > > The result showed the errors gradually increased with phi which lead me to > the scale error in the PI value used in dphi. > > Here is the crux of that scale error. > perldl> p 4*atan2(1,1) > 3.14159265358979 > perldl> p acos(-1.) > 3.14159274101257 > > The first is the correct value of PI to the printed precision, the second > is wrong in the 7th place. In contrast, the C math library (and every > other language binding we have) calculates PI to full precision > without problems for acos(-1.) > > Doug, will you please do the honors and make the appropriate bug report? > This is ugly, and I am amazed such a perl math library error is still with > us after all these years. It turns out that 'acos' is not a *perl* function, but it is a *PDL* function. So, I have more control over this--I'll look into it. Good catch! --Doug ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel