----- Original Message ----- From: "David Mertens" <[email protected]>
To: "Chris Marshall" <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Wednesday, January 25, 2012 1:37 AM
Subject: Re: [Perldl] list args support for PDL::Ops?


The PDL::atan2 can be cleaned up by using a PMCode section for the function definition. However, the general issue with atan2 cannot, AFAICT. Here's an
example from the Perl debugger REPL:

-----------%<-----------

perl -d -e 1

Loading DB routines from perl5db.pl version 1.32
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):    1

 DB<1> p atan2(1,2)
0.463647609000806

 DB<2> @b = (1,2)

 DB<3> p atan2(@b)
Not enough arguments for atan2 at (eval 10)[/usr/share/perl/5.10/
perl5db.pl:638] line 2, near "@b)"

-----------%<-----------

That means that perl's atan2 has a signature that *requires* two scalars. I
don't think we can do anything to fix that.

Seems that atan2 takes its arguments in scalar context, so atan2(@s) is seen as atan2(scalar(@s)) .... which, of course, is one argument short of the quota:

#################
use warnings;

$atan2 = atan2(3,4);
print $atan2, "\n";

@s = (-12,19,118);
$atan2 = atan2(@s, 4);
print $atan2, "\n";
#################

For me, that outputs:
0.643501108793284
0.643501108793284

My initial thought was that this is a bug, but reading through the perlfunc docs suggests that it is allowable - and the atan2 docs do specify "atan2 Y,X", not "atan2 LIST".

Cheers,
Rob

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to