Mercurial > hg > octave-nkf
annotate scripts/elfun/atan2d.m @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
16938
diff
changeset
|
1 ## Copyright (C) 2013-2015 Rik Wehbring |
16938 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {} atan2d (@var{y}, @var{x}) | |
21 ## Compute atan2 (@var{y} / @var{x}) in degrees for corresponding elements | |
22 ## from @var{y} and @var{x}. | |
23 ## @seealso{tand, atan2} | |
24 ## @end deftypefn | |
25 | |
26 function retval = atan2d (y, x) | |
27 | |
28 if (nargin != 2) | |
29 print_usage (); | |
30 endif | |
31 | |
32 retval = 180 ./ pi .* atan2 (y, x); | |
33 | |
34 endfunction | |
35 | |
36 | |
37 %!assert (atan2d (-1:.1:1, 1:-.1:-1), 180/pi * atan2 (-1:.1:1, 1:-.1:-1), -10*eps) | |
38 | |
39 %!error atan2d () | |
40 %!error atan2d (1) | |
41 |