Mercurial > hg > octave-nkf
comparison scripts/elfun/tand.m @ 14220:5a13a75c2457
Use Octave spacing conventions for scripts in elfun/ directory.
* acosd.m, acot.m, acotd.m, acoth.m, acsc.m, acscd.m, acsch.m, asec.m, asecd.m,
asech.m, asind.m, atand.m, cosd.m, cot.m, cotd.m, coth.m, csc.m, cscd.m,
csch.m, sec.m, secd.m, sech.m, sind.m, tand.m: Use Octave spacing conventions.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Wed, 18 Jan 2012 21:17:14 -0800 |
parents | 72c96de7a403 |
children | f3d52523cde1 |
comparison
equal
deleted
inserted
replaced
14219:addec4a8a787 | 14220:5a13a75c2457 |
---|---|
25 ## @end deftypefn | 25 ## @end deftypefn |
26 | 26 |
27 ## Author: David Bateman <dbateman@free.fr> | 27 ## Author: David Bateman <dbateman@free.fr> |
28 | 28 |
29 function y = tand (x) | 29 function y = tand (x) |
30 | |
30 if (nargin != 1) | 31 if (nargin != 1) |
31 print_usage (); | 32 print_usage (); |
32 endif | 33 endif |
34 | |
33 I0 = x / 180; | 35 I0 = x / 180; |
34 I90 = (x-90) / 180; | 36 I90 = (x-90) / 180; |
35 y = tan (I0 .* pi); | 37 y = tan (I0 .* pi); |
36 y(I0 == fix (I0) & finite (I0)) = 0; | 38 y(I0 == fix (I0) & finite (I0)) = 0; |
37 y(I90 == fix (I90) & finite (I90)) = Inf; | 39 y(I90 == fix (I90) & finite (I90)) = Inf; |
38 endfunction; | |
39 | 40 |
40 %!error(tand()) | 41 endfunction |
41 %!error(tand(1,2)) | 42 |
42 %!assert(tand(10:10:80),tan(pi*[10:10:80]/180),-10*eps) | 43 |
43 %!assert(tand([0,180,360]) == 0) | 44 %!assert (tand (10:10:80), tan (pi*[10:10:80]/180), -10*eps) |
44 %!assert(tand([90,270]) == Inf) | 45 %!assert (tand ([0, 180, 360]) == 0) |
46 %!assert (tand ([90, 270]) == Inf) | |
47 | |
48 %!error tand () | |
49 %!error tand (1, 2) |