1
1
// =============================================================================
2
2
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3
3
// Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@scilab.org>
4
// Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
5
6
// This file is distributed under the same license as the Scilab package.
6
7
// =============================================================================
9
10
// =============================================================================
12
if execstr("asin()" ,"errcatch") == 0 then bugmes();quit;end
13
if execstr("asin(1,2)","errcatch") == 0 then bugmes();quit;end
13
assert_checkfalse(execstr("asin()", "errcatch") == 0);
14
assert_checkfalse(execstr("asin(1,2)", "errcatch") == 0);
14
15
// 2. Singular Values
15
16
// ==================
18
19
v = [0 , %pi/6 , %pi/4 , %pi/3 , %pi/2 , %pi/3 , %pi/4 , %pi/6 , 0 ];
19
20
x = [0 , 1/2 , rt2/2 , rt3/2 , 1 , rt3/2 , rt2/2 , 1/2 , 0 ];
20
if or(abs(asin(x)-v) > sqrt (%eps)) then bugmes();quit;end
22
assert_checkalmostequal(y,v);
23
if ~isnan(asin(%nan)) then bugmes();quit;end
24
if ~isnan(asin(-%nan)) then bugmes();quit;end
25
assert_checktrue(isnan(asin(%nan)));
26
assert_checktrue(isnan(asin(-%nan)));
29
assert_checkequal(imag(asin(%inf)),%inf);
30
assert_checkequal(imag(asin(-%inf)),%inf);
30
34
// asin(-x) = - asin(x)
31
if or( asin(-A) + asin(A) > %eps) then bugmes();quit;end
35
assert_checkalmostequal(asin(-A), -asin(A));
32
36
// asin(x) = acos(-x) - pi/2
33
if or( (asin(A) - acos(-A) + %pi/2) > %eps ) then bugmes();quit;end
37
assert_checkalmostequal(asin(A), acos(-A) - %pi / 2);