[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #66642] cellfun & arrayfun return zero values
From: |
Fernando |
Subject: |
[Octave-bug-tracker] [bug #66642] cellfun & arrayfun return zero values if function returns fewer outputs than expected |
Date: |
Wed, 23 Apr 2025 13:06:04 -0400 (EDT) |
Follow-up Comment #16, bug #66642 (group octave):
I am attaching a patch with some BIST tests. They cover the 6 new error
messages introduced, 3 for cellfun:
- cellfun, uniform output, first function call produces fewer outputs than
requested.
- the same, but not first function call.
- cellfun, non-uniform output.
and the corresponding 3 for arrayfun.
I also added two tests (one for cellfun and another one for arrayfun)
considering the case when the provided function returns MORE outputs than
requested, which is correct (extra outputs are ignored).
I also noticed a strange behaviour when calling cellfun (or arrayfun) without
output arguments and one of the function calls does not return anything.
E.g.:
octave:> function [r]=f(x); if x>0 r=x; end; end
octave:> cellfun(@f,{1,-2})
ans =
1 0
I would expect the same error as in this case:
octave:> a=cellfun(@f,{1,-2})
error: cellfun: function returned fewer than nargout values
Also, in this other case, with the same f, you get a warning that you reach a
code that should be unrechable:
octave:> cellfun(@f,{-1,2})
warning: cellfun: This code should be unreachable. Please report to
bugs.octave.org
ans =
0 2
I would also expect the same error as before.
(file #57164)
_______________________________________________________
Additional Item Attachment:
File name: bist-66642.txt Size: 3KiB
<https://file.savannah.gnu.org/file/bist-66642.txt?file_id=57164>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-962f8dd2e65d30409210f66560945e9bbc413549.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?66642>
_______________________________________________
Mensaje enviado vía Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- [Octave-bug-tracker] [bug #66642] cellfun & arrayfun return zero values if function returns fewer outputs than expected,
Fernando <=
Message not available