~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/elementary_functions/tests/unit_tests/asin.dia.ref

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
4
5
//
5
6
//  This file is distributed under the same license as the Scilab package.
6
7
// =============================================================================
9
10
// =============================================================================
10
11
// 1. Interface
11
12
// ============
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
// ==================
16
17
rt2 = sqrt(2);
17
18
rt3 = sqrt(3);
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
 
21
y = asin(x);
 
22
assert_checkalmostequal(y,v);
21
23
// 3. Not A Number
22
24
// ===============
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)));
25
27
// 4. Limit values
26
28
// ===============
 
29
assert_checkequal(imag(asin(%inf)),%inf);
 
30
assert_checkequal(imag(asin(-%inf)),%inf);
27
31
// 5. Properties
28
32
// =============
29
33
A = rand(100,100);
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);