|
| From: | David Bateman |
| Subject: | [Octave-bug-tracker] [bug #31974] Interpreter fails to create complex numbers with Inf complex parts |
| Date: | Wed, 29 Dec 2010 23:11:29 +0000 |
| User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009091010 Iceweasel/3.0.14 (Debian-3.0.14-1) |
Follow-up Comment #8, bug #31974 (project octave):
I had a look at coding this as it seemed to me that everything could be
treated in the function
oct-parse.yy (static tree_expression * fold (tree_binary_expression *))
but the problem is harder than I thought.. We need to treat not just "Inf *
j" but also "Inf * 1j" as the parser treats the first as two identifiers and
the second as an identifier times a constant. However identifier can be
overloaded by user functions and variables, so
Inf = pi;
Inf * j
should return "0 + pi * j" so a simple test of the identifier in the parser
can work. A solution for the above I looked at however is stymied by the case
for i = 1 : 10
d(i) = Inf * j;
Inf = pi;'t
endfor
as d(1) should be "0 + Inf * j" but d(2:10) should be "0 + pi * j".
Also another test case for matlab is
x = Inf;
x * j
Does this return "0 + j" or "NaN + j"? And what about
j = Complex (0, 1);
Inf * j
does it return "0 + j" or "NaN + j"? And finally what about if you create a
user function
function y = fcn ()
y = Inf;
end
and then run
fcn * j
does it return "0 + j" or "NaN + j"? If the above three cases all return "0 +
j" then the problem should be treated in ov.cc (do_binary_op) rather then in
the parser and the problems above would go away.
D.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31974>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
| [Prev in Thread] | Current Thread | [Next in Thread] |