Problem with warning for conversioon of atan
Reported by Federico Miyara
BUG DESCRIPTION:
----------------
When converting a Matlab function that contains the atan function, the converted file has a warning about the input argument range that seems incorrect (see ERROR LOG).
Both Matlab and Scilab atan (arc tangent) are not limited to any range. For instance, in Scilab atan(1000) = 1.56979632712822981. Input argument 1000 exceeds the alleged limit and still the sign is the expected one.
ERROR LOG:
----------
// !! L.2: If mtlb_double(x) is outside [-1,1]
// !! real part of output of atan(mtlb_double(x)) will be the opposite of Matlab one.
HOW TO REPRODUCE THE BUG:
-------------------------
Define the following Matlab function:
function y = arctg(x)
y = atan(x);
and save it as c:\arctg.m (or any other directory)
Run
mfile2sci('c:\arctg.m')
The result, arctg.sci, is:
function [y] = arctg(x)
// Output variables initialisation (not found in input variables)
y=[];
// Display mode
mode(0);
// Display warning for floating point exception
ieee(1);
// !! L.2: If mtlb_double(x) is outside [-1,1]
// !! real part of output of atan(mtlb_double(x)) will be the opposite of Matlab one.
y = atan(mtlb_double(x));
endfunction
OTHER INFORMATION:
------------------
Probably the warning was intended for functions like asin or acos, which indeed might present differences outside the domain where they produce a single-valued real result.