On 10/03/2014 03:03, David Spies wrote:

> I noticed that:

>

> octave:1> isequal(1,2)

> ans = 1

>

> I'm guessing this is a bug. Nonetheless, why is there even a separate

> isequal function? Why can't it just be defined as

>

> function [res] = isequal(a,b)

> res = (a == b)

> endfunction

>

> Are there types for which it's meant to differ from ==? Is this

> supposed to be used for some sort of test?

a == b would return the elementwise logical matrix of comparisons

isequal always returns a single boolean, only if every value in the

matrix is the same, so more like:

res = all((a == b)(:))

i.e.

>> a = [1 2 ; 3 4], b = [1 1; 1 1], a == b

a =

1 2

3 4

b =

1 1

1 1

ans =

1 0

0 0

>> isequal (a,b)

ans = 0

but as also pointed out by another, isequal also takes any number of

arguments.

Your example should definitely return true however, and does so on the

development version at least for me on Mint Linux 16:

>> isequal (1,2)

ans = 0

Richard

--

The University of Edinburgh is a charitable body, registered in

Scotland, with registration number SC005336.