Oops, sorry, I missed a line when copying the text. Here is the code again.

use PDL;
use PDL::NiceSlice;


my $x = pdl(1, 2, 3, 0);
$x->badflag(1);
$x->badvalue(0);

print "x = $x\n";

my ($m, $s) = stats($x);

print "m = $m, s = $s\n";
print "s greater than zero\n" if $s > 0;
print "s less than zero\n" if $s < 0;
print "s equals zero\n" if $s == 0;


On Tue, 16 Jun 2015 at 12:20 Chris Marshall <[email protected]> wrote:

>  Hi Marek-
>
> Do you have a complete example showing the problem?
> You don't show where $m and $s are being set below.
>
> Thanks,
> Chris
>
>
> On 6/16/2015 07:04, Marek Gierliński wrote:
>
> I have recently encountered a weird problem with stats (or statsover)
> using bad values. The resulting numbers have a strange property, they
> always return true in comparisons. This code:
>
>  use PDL;
> use PDL::NiceSlice;
>
>  my $x = pdl(1, 2, 3, 0);
> $x->badflag(1); $x->badvalue(0);
>
>  print "m = $m, s = $s\n";
> print "s greater than zero\n" if $s > 0;
> print "s less than zero\n" if $s < 0;
> print "s equals zero\n" if $s == 0;
>
>  returns the following output:
>
>  x = [1 2 3 BAD]
> m = 2, s = 1
> s greater than zero
> s less than zero
> s equals zero
>
>  which doesn't make any sense. Can anyone explain this? I always assumed
> that 'stats' returned ordinary Perl scalars, but this must be something
> different.
>
>  I'm using PDL version 2.007. We had an older version installed for a
> long time and I think this problem appeared when we upgraded to 2.007.
>
>  Marek
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> pdl-general mailing 
> [email protected]https://lists.sourceforge.net/lists/listinfo/pdl-general
>
>
>
------------------------------------------------------------------------------
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to