any() function handles int types wrong...
John W. Eaton
jwe at bevo.che.wisc.edu
Sun May 11 23:15:01 CDT 2008
On 9-May-2008, Nicholas Jankowski wrote:
| Bug report for Octave 3.0.1 configured for i686-pc-msdosmsvc
|
| Description:
| -----------
| running the any() function should give 0 only if everything in the
| array is a zero. however, it apparently only works correctly if the
| thing you you run it on is type double. uint, int, logical types all
| produce erroneous results. I cut and pasted some input/output
| statements below.
|
|
| Repeat-By:
| ---------
| >blah=[121 1 95 88 77 ; 81 89 83 80 79 ]
| blah =
|
| 121 1 95 88 77
| 81 89 83 80 79
|
|
| > class(blah)
| ans = double
|
| > any(blah)
| ans =
|
| 1 1 1 1 1 *******THIS IS THE CORRECT ANSWER*******
|
| > blah=int16(blah)
| blah =
|
| 121 1 95 88 77
| 81 89 83 80 79
|
| > any(blah)
| ans =
|
| 0 0 0 0 0 *******WRONG. Changing type should not change
| answer*******
I think the following patch will fix this problem. It was applied to
the default branch but somehow missed for the branch used to create
the 3.0.1 release.
jwe
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080511/f2a9dc3b/attachment.ksh
More information about the Bug-octave
mailing list