When I declare y a float and then say y:3^0.33, then the
compiler doesn't assign 'type float' but 'type any'. Does somebody know
why this is the case and how to make y a float as well?
f(x):=block([y],
mode_declare(x,float,y,float),
y:3^0.333,
return(y)
)$
compile(f);
warning: variable y (declared type float) assigned type any.
Code from Stavros Macrakis:
Thanks for the report. The <translate> routine is being too pessimistic in the case <float>^<non-integer>; if the base were negative, the result can be imaginary (and therefore not a float). But in this case, the base is an explicit non-negative number.
(%i4) f():=
block([w,x,y,z],modedeclare([w,x,y,z],float),
w:3.4/5.5, x: 3.4^(1/3), y:3.4^5.5, z:4.5^-4, 0)$
(%i5) translate(f)$
warning: variable x (declared type float) assigned type any.
warning: variable y (declared type float) assigned type any.
my debug_info:
Maxima version: "5.33.0"
Maxima build date: "2014-04-06 18:12:54"
Host type: "x86_64-unknown-linux-gnu"
Lisp implementation type: "CLISP"
Lisp implementation version: "2.49 (2010-07-07) (built on koolmees [192.168.1.100])"
This should be fixed by commit [f708a1], which I just pushed to the repository.
Related
Commit: [f708a1]