In one program I made a mistake today which was difficult to find. To
illustrate my mistake, consider the following oneliner:
$ perl -MPDL -MPDL::Complex -E '$z=1+i; say $z->real > 0'
The complex variable is converted to a pdl with two reals both of
which are greater than zero, so the result is [1 1]. However, if I
forget to take the real part and compare a complex number to a real one
$ perl -MPDL -MPDL::Complex -E '$z=1+i; say $z > 0'
I get a segmentation fault. If I run the same script with the debugger
I get the message
DB::DB(/home/mochan/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/x86_64-linux/PDL/Complex.pm:271):
271: &PDL::Complex::_r2C_int($_[0], $r);
997 levels deep in subroutine calls!
The same happens if I try to compare two complex numbers. Though I understand
it is meaningless to compare complex numbers, maybe a more informative
error might be generated before or instead of the segfault.
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
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general