octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Operator precedence tests show 3 failures


From: Rik
Subject: Re: Operator precedence tests show 3 failures
Date: Sun, 20 Mar 2011 09:17:18 -0700

On 03/20/2011 01:42 AM, marco atzeri wrote:
> On Fri, Mar 18, 2011 at 5:40 PM, Rik  wrote:
>> 3/18/11
>>
>> I just checked in some tests for the Octave parser (test_parser.m in
>> tests/).  The current parser shows 3 failures.  These are known, but until
>> jwe gets a chance to modify his proposed patch be aware that your 'make
>> check' will not run cleanly.
>>
>> --Rik
>>
> 
> at least 1 seems obvious
> -------------------------------------------
> assert ([2, 3] .^ 2',[4; 9]) expected
>    4
>    9
> but got
>    4   9
> Dimensions don't match
> -------------------------------------------
> 
> the test should be:
> 
> assert ([2; 3] .^ 2',[4; 9]) expected
> 
> to match dimensions of argument and result
> Marco
> 
Actually, the point is that exponentiation has higher precedence in Octave
than the transpose operator.  This should be parsed as
([2, 3] .^ 2)'.  Instead it is parsed as [2, 3] .^ (2').  Transposing a
scalar does nothing nothing so Octave returns a row vector where it should
return a column vector.  The original bug report is here
(https://savannah.gnu.org/bugs/?32533).

For Ben's point, we are not trying to match Matlab's equal precedence for
transpose and exponentiation.  Octave has it's own table for precedence and
exponentiation is the highest priority.  We merely want to follow our own
rules and documented behavior.

Cheers,
Rik


reply via email to

[Prev in Thread] Current Thread [Next in Thread]