acoth() conversion with mfile2sci() uses atanh() instead of acoth(), and yields a wrong warning message
@sgougeon)
Reported by Samuel GOUGEON (BUG DESCRIPTION:
----------------
File = TMPDIR + "/bug_16000_acoth";
mputl(["x = 4;" "y = acoth(x);"], File + ".m");
mfile2sci(File + ".m", TMPDIR)
t = mgetl(File + ".sci")
yields
../..
!x = 4; !
!// !! L.2: If x is outside [-1,1] !
!// !! complex part of output of acoth(x) will be the opposite of Matlab one. !
!y = atanh(1 ./x); !
So:
1) y = acoth(x)
should be output instead of atanh(1 ./x)
2) The warning should be
!// !! L.2: If x is IN [0,1] !
!// !! complex part of output of acoth(x) will be the opposite of Matlab one. !
Indeed, we have:
MATLAB 2016 :
>> acoth([-0.5 -0.1 0 0.5]')
ans =
-0.5493 - 1.5708i
-0.1003 - 1.5708i
0.0000 + 1.5708i
0.5493 + 1.5708i
Scilab 5.1 ... 6.0.x :
--> acoth([-0.5 -0.1 0 0.5]')
ans =
-0.5493061 - 1.5707963i
-0.1003353 - 1.5707963i
- 1.5707963i
0.5493061 - 1.5707963i
Octave 5.1.0:
>> acoth([-0.5 -0.1 0 0.5]')
ans =
-0.5493 + 1.5708i
-0.1003 + 1.5708i
0.0000 + 1.5708i
0.5493 + 1.5708i
So, the discrepancy with Matlab is only for x on [0 1].
The page https://help.scilab.org/docs/6.0.2/en_US/m2sci_acoth.html
must also be fixed:
"For x real in ]-1,1[, imag(acoth(x)) is +?/2 in Matlab and -?/2 in Scilab."
Should be
"For x real in [0, 1[, imag(acoth(x)) is -π/2 in Scilab and +π/2 in Matlab."
ERROR LOG:
----------
None. Wrong output and help page.
HOW TO REPRODUCE THE BUG:
-------------------------
File = TMPDIR + "/bug_16000_acoth";
mputl(["x = 4;" "y = acoth(x);"], File + ".m");
mfile2sci(File + ".m", TMPDIR)
t = mgetl(File + ".sci")
OTHER INFORMATION:
------------------
May be impacted by atanh():
https://www.mail-archive.com/dev@lists.scilab.org/msg01172.html
Edited by Vincent COUVERT