Hi

I think it works as expected. What you are testing is if all ($a) is 0,
which is true, since one element in $a is 0.

You have to be careful with brackets.

pdl> print all($a)==0;  # all returns 0 since the last value in $a == 0.
1
pdl> print all($a==0); # all returns 0 because only one $a contains only
one 0.
0
pdl> print all($a);  # all returns 0 since the last value in $a is 0
(representing false).
0

I hope this helps,

Ingo


On 22.12.23 15:02, Yury Pakhomov wrote:
Hello All

I faced with strange behavior in function "all"

$a=pdl(1,1,1,0);
print all($a)==0;

returns 1


Best regards,

Yury




_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general


_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to