Mercurial > octave
annotate libinterp/corefcn/mappers.cc @ 20805:2d6ddb2b157c
eliminate return statements after calls to print_usage
* file-io.cc, mappers.cc:
Eliminate return statements after calls to print_usage.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 04 Dec 2015 14:53:09 -0500 |
parents | 4e7f12a763cd |
children | 1142cf6abc0d |
rev | line source |
---|---|
1 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19359
diff
changeset
|
3 Copyright (C) 1993-2015 John W. Eaton |
11523 | 4 Copyright (C) 2009-2010 VZLU Prague |
1 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
1 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
1 | 21 |
22 */ | |
23 | |
240 | 24 #ifdef HAVE_CONFIG_H |
1192 | 25 #include <config.h> |
1 | 26 #endif |
27 | |
2089 | 28 #include <cctype> |
3010 | 29 #include <cfloat> |
1 | 30 |
4524 | 31 #include "lo-ieee.h" |
3156 | 32 #include "lo-specfun.h" |
2889 | 33 #include "lo-mappers.h" |
34 | |
1352 | 35 #include "defun.h" |
36 #include "error.h" | |
2955 | 37 #include "variables.h" |
1 | 38 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
39 DEFUN (abs, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
40 "-*- texinfo -*-\n\ |
3321 | 41 @deftypefn {Mapping Function} {} abs (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
42 Compute the magnitude of @var{z}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
43 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
44 The magnitude is defined as\n\ |
3321 | 45 @tex\n\ |
46 $|z| = \\sqrt{x^2 + y^2}$.\n\ | |
47 @end tex\n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
48 @ifnottex\n\ |
3321 | 49 |@var{z}| = @code{sqrt (x^2 + y^2)}.\n\ |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
50 @end ifnottex\n\ |
3321 | 51 \n\ |
10840 | 52 For example:\n\ |
3321 | 53 \n\ |
54 @example\n\ | |
55 @group\n\ | |
56 abs (3 + 4i)\n\ | |
57 @result{} 5\n\ | |
58 @end group\n\ | |
59 @end example\n\ | |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
60 @seealso{arg}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
61 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
62 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
63 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
64 print_usage (); |
529 | 65 |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
66 return octave_value (args(0).abs ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
67 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
68 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
69 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
70 %!assert (abs (1), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
71 %!assert (abs (-3.5), 3.5) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
72 %!assert (abs (3+4i), 5) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
73 %!assert (abs (3-4i), 5) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
74 %!assert (abs ([1.1, 3i; 3+4i, -3-4i]), [1.1, 3; 5, 5]) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
75 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
76 %!assert (abs (single (1)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
77 %!assert (abs (single (-3.5)), single (3.5)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
78 %!assert (abs (single (3+4i)), single (5)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
79 %!assert (abs (single (3-4i)), single (5)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
80 %!assert (abs (single ([1.1, 3i; 3+4i, -3-4i])), single ([1.1, 3; 5, 5])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
81 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
82 %!error abs () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
83 %!error abs (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
84 */ |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
85 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
86 DEFUN (acos, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 "-*- texinfo -*-\n\ |
3428 | 88 @deftypefn {Mapping Function} {} acos (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
89 Compute the inverse cosine in radians for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
90 @seealso{cos, acosd}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
91 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
92 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
93 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
94 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
95 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
96 return octave_value (args(0).acos ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
97 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
98 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
99 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
100 %!shared rt2, rt3 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
101 %! rt2 = sqrt (2); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
102 %! rt3 = sqrt (3); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
103 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
104 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
105 %! x = [1, rt3/2, rt2/2, 1/2, 0, -1/2, -rt2/2, -rt3/2, -1]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
106 %! v = [0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
107 %! assert (acos (x), v, sqrt (eps)); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
108 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
109 %!test |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
110 %! x = single ([1, rt3/2, rt2/2, 1/2, 0, -1/2, -rt2/2, -rt3/2, -1]); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
111 %! v = single ([0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
112 %! assert (acos (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
113 |
19242
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
114 ## Test values on either side of branch cut |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
115 %!test |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
116 %! rval = 0; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
117 %! ival = 1.31695789692481635; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
118 %! obs = acos ([2, 2-i*eps, 2+i*eps]); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
119 %! exp = [rval + ival*i, rval + ival*i, rval - ival*i]; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
120 %! assert (obs, exp, 2*eps); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
121 %! rval = pi; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
122 %! obs = acos ([-2, -2-i*eps, -2+i*eps]); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
123 %! exp = [rval - ival*i, rval + ival*i, rval - ival*i]; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
124 %! assert (obs, exp, 2*eps); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
125 %! assert (acos ([2 0]), [ival*i, pi/2], 2*eps); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
126 %! assert (acos ([2 0i]), [ival*i, pi/2], 2*eps); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
127 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
128 %!error acos () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
129 %!error acos (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
130 */ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
131 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
132 DEFUN (acosh, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
133 "-*- texinfo -*-\n\ |
3428 | 134 @deftypefn {Mapping Function} {} acosh (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
135 Compute the inverse hyperbolic cosine for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
136 @seealso{cosh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
137 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
138 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
139 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
140 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
141 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
142 return octave_value (args(0).acosh ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
143 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
144 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
145 /* |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
146 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
147 %! x = [1, 0, -1, 0]; |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
148 %! v = [0, pi/2*i, pi*i, pi/2*i]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
149 %! assert (acosh (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
150 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
151 %!test |
19730
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
152 %! re = 2.99822295029797; |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
153 %! im = pi/2; |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
154 %! assert (acosh (-10i), re - i*im); |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
155 |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
156 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
157 %! x = single ([1, 0, -1, 0]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
158 %! v = single ([0, pi/2*i, pi*i, pi/2*i]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
159 %! assert (acosh (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
160 |
19730
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
161 %!test |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
162 %! re = single (2.99822295029797); |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
163 %! im = single (pi/2); |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
164 %! assert (acosh (single (10i)), re + i*im, 5*eps ("single")); |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
165 %! assert (acosh (single (-10i)), re - i*im, 5*eps ("single")); |
554aaaf99644
Fix return phase of acosh to match Matlab (bug #44286).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
166 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
167 %!error acosh () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
168 %!error acosh (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
169 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
170 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
171 DEFUN (angle, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
172 "-*- texinfo -*-\n\ |
3458 | 173 @deftypefn {Mapping Function} {} angle (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
174 See @code{arg}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
175 @seealso{arg}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
176 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
177 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
178 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
179 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
180 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
181 return octave_value (args(0).arg ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
182 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
183 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
184 DEFUN (arg, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
185 "-*- texinfo -*-\n\ |
10840 | 186 @deftypefn {Mapping Function} {} arg (@var{z})\n\ |
3458 | 187 @deftypefnx {Mapping Function} {} angle (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
188 Compute the argument, i.e., angle of @var{z}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
189 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
190 This is defined as,\n\ |
9154
761fc0d3d980
Update section 17.2 (Complex Arithmetic) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9153
diff
changeset
|
191 @tex\n\ |
761fc0d3d980
Update section 17.2 (Complex Arithmetic) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9153
diff
changeset
|
192 $\\theta = atan2 (y, x),$\n\ |
761fc0d3d980
Update section 17.2 (Complex Arithmetic) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9153
diff
changeset
|
193 @end tex\n\ |
761fc0d3d980
Update section 17.2 (Complex Arithmetic) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9153
diff
changeset
|
194 @ifnottex\n\ |
761fc0d3d980
Update section 17.2 (Complex Arithmetic) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9153
diff
changeset
|
195 @var{theta} = @code{atan2 (@var{y}, @var{x})},\n\ |
761fc0d3d980
Update section 17.2 (Complex Arithmetic) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9153
diff
changeset
|
196 @end ifnottex\n\ |
761fc0d3d980
Update section 17.2 (Complex Arithmetic) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9153
diff
changeset
|
197 in radians.\n\ |
3321 | 198 \n\ |
10840 | 199 For example:\n\ |
3321 | 200 \n\ |
201 @example\n\ | |
202 @group\n\ | |
203 arg (3 + 4i)\n\ | |
204 @result{} 0.92730\n\ | |
205 @end group\n\ | |
206 @end example\n\ | |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
207 @seealso{abs}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
208 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
209 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
210 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
211 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
212 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
213 return octave_value (args(0).arg ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
214 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
215 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
216 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
217 %!assert (arg (1), 0) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
218 %!assert (arg (i), pi/2) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
219 %!assert (arg (-1), pi) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
220 %!assert (arg (-i), -pi/2) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
221 %!assert (arg ([1, i; -1, -i]), [0, pi/2; pi, -pi/2]) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
222 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
223 %!assert (arg (single (1)), single (0)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
224 %!assert (arg (single (i)), single (pi/2)) |
13093
1a21c4c5eeeb
Fix tolerance for mappers.cc test on MacOS.
Ben Abbott <bpabbott@mac.com>
parents:
12894
diff
changeset
|
225 %!test |
1a21c4c5eeeb
Fix tolerance for mappers.cc test on MacOS.
Ben Abbott <bpabbott@mac.com>
parents:
12894
diff
changeset
|
226 %! if (ismac ()) |
1a21c4c5eeeb
Fix tolerance for mappers.cc test on MacOS.
Ben Abbott <bpabbott@mac.com>
parents:
12894
diff
changeset
|
227 %! ## Avoid failing for a MacOS feature |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
228 %! assert (arg (single (-1)), single (pi), 2*eps (single (1))); |
13093
1a21c4c5eeeb
Fix tolerance for mappers.cc test on MacOS.
Ben Abbott <bpabbott@mac.com>
parents:
12894
diff
changeset
|
229 %! else |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
230 %! assert (arg (single (-1)), single (pi)); |
13093
1a21c4c5eeeb
Fix tolerance for mappers.cc test on MacOS.
Ben Abbott <bpabbott@mac.com>
parents:
12894
diff
changeset
|
231 %! endif |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
232 %!assert (arg (single (-i)), single (-pi/2)) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
233 %!assert (arg (single ([1, i; -1, -i])), single ([0, pi/2; pi, -pi/2]), 2e1*eps ("single")) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
234 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
235 %!error arg () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
236 %!error arg (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
237 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
238 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
239 DEFUN (asin, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
240 "-*- texinfo -*-\n\ |
3428 | 241 @deftypefn {Mapping Function} {} asin (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
242 Compute the inverse sine in radians for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
243 @seealso{sin, asind}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
244 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
245 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
246 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
247 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
248 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
249 return octave_value (args(0).asin ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
250 } |
529 | 251 |
7385 | 252 /* |
19242
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
253 %!shared rt2, rt3 |
7385 | 254 %! rt2 = sqrt (2); |
255 %! rt3 = sqrt (3); | |
19242
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
256 |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
257 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
258 %! x = [0, 1/2, rt2/2, rt3/2, 1, rt3/2, rt2/2, 1/2, 0]; |
7385 | 259 %! v = [0, pi/6, pi/4, pi/3, pi/2, pi/3, pi/4, pi/6, 0]; |
19242
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
260 %! assert (asin (x), v, sqrt (eps)); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
261 |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
262 %!test |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
263 %! x = single ([0, 1/2, rt2/2, rt3/2, 1, rt3/2, rt2/2, 1/2, 0]); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
264 %! v = single ([0, pi/6, pi/4, pi/3, pi/2, pi/3, pi/4, pi/6, 0]); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
265 %! assert (asin (x), v, sqrt (eps ("single"))); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
266 |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
267 ## Test values on either side of branch cut |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
268 %!test |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
269 %! rval = pi/2; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
270 %! ival = 1.31695789692481635; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
271 %! obs = asin ([2, 2-i*eps, 2+i*eps]); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
272 %! exp = [rval - ival*i, rval - ival*i, rval + ival*i]; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
273 %! assert (obs, exp, 2*eps); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
274 %! obs = asin ([-2, -2-i*eps, -2+i*eps]); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
275 %! exp = [-rval + ival*i, -rval - ival*i, -rval + ival*i]; |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
276 %! assert (obs, exp, 2*eps); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
277 %! assert (asin ([2 0]), [rval - ival*i, 0], 2*eps); |
ba7e42dea4b2
Fix returned phase of asin, acos outside principal branch (bug #43349).
Rik <rik@octave.org>
parents:
19151
diff
changeset
|
278 %! assert (asin ([2 0i]), [rval - ival*i, 0], 2*eps); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
279 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
280 %!error asin () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
281 %!error asin (1, 2) |
7385 | 282 */ |
283 | |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
284 DEFUN (asinh, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
285 "-*- texinfo -*-\n\ |
3428 | 286 @deftypefn {Mapping Function} {} asinh (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
287 Compute the inverse hyperbolic sine for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
288 @seealso{sinh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
289 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
290 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
291 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
292 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
293 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
294 return octave_value (args(0).asinh ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
295 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
296 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
297 /* |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
298 %!test |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
299 %! v = [0, pi/2*i, 0, -pi/2*i]; |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
300 %! x = [0, i, 0, -i]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
301 %! assert (asinh (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
302 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
303 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
304 %! v = single ([0, pi/2*i, 0, -pi/2*i]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
305 %! x = single ([0, i, 0, -i]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
306 %! assert (asinh (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
307 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
308 %!error asinh () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
309 %!error asinh (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
310 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
311 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
312 DEFUN (atan, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
313 "-*- texinfo -*-\n\ |
3428 | 314 @deftypefn {Mapping Function} {} atan (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
315 Compute the inverse tangent in radians for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
316 @seealso{tan, atand}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
317 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
318 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
319 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
320 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
321 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
322 return octave_value (args(0).atan ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
323 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
324 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
325 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
326 %!shared rt2, rt3 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
327 %! rt2 = sqrt (2); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
328 %! rt3 = sqrt (3); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
329 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
330 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
331 %! v = [0, pi/6, pi/4, pi/3, -pi/3, -pi/4, -pi/6, 0]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
332 %! x = [0, rt3/3, 1, rt3, -rt3, -1, -rt3/3, 0]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
333 %! assert (atan (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
334 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
335 %!test |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
336 %! v = single ([0, pi/6, pi/4, pi/3, -pi/3, -pi/4, -pi/6, 0]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
337 %! x = single ([0, rt3/3, 1, rt3, -rt3, -1, -rt3/3, 0]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
338 %! assert (atan (x), v, sqrt (eps ("single"))); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
339 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
340 %!error atan () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
341 %!error atan (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
342 */ |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
343 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
344 DEFUN (atanh, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
345 "-*- texinfo -*-\n\ |
3428 | 346 @deftypefn {Mapping Function} {} atanh (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
347 Compute the inverse hyperbolic tangent for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
348 @seealso{tanh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
349 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
350 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
351 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
352 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
353 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
354 return octave_value (args(0).atanh ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
355 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
356 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
357 /* |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
358 %!test |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
359 %! v = [0, 0]; |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
360 %! x = [0, 0]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
361 %! assert (atanh (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
362 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
363 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
364 %! v = single ([0, 0]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
365 %! x = single ([0, 0]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
366 %! assert (atanh (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
367 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
368 %!error atanh () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
369 %!error atanh (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
370 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
371 |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
372 DEFUN (cbrt, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
373 "-*- texinfo -*-\n\ |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
374 @deftypefn {Mapping Function} {} cbrt (@var{x})\n\ |
11532
34bb8d38f19f
Add undocumented function cbrt to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11529
diff
changeset
|
375 Compute the real cube root of each element of @var{x}.\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
376 \n\ |
11532
34bb8d38f19f
Add undocumented function cbrt to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11529
diff
changeset
|
377 Unlike @code{@var{x}^(1/3)}, the result will be negative if @var{x} is\n\ |
34bb8d38f19f
Add undocumented function cbrt to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11529
diff
changeset
|
378 negative.\n\ |
34bb8d38f19f
Add undocumented function cbrt to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11529
diff
changeset
|
379 @seealso{nthroot}\n\ |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
380 @end deftypefn") |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
381 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
382 if (args.length () != 1) |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
383 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
384 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
385 return octave_value (args(0).cbrt ()); |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
386 } |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
387 |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
388 /* |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
389 %!assert (cbrt (64), 4) |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
390 %!assert (cbrt (-125), -5) |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
391 %!assert (cbrt (0), 0) |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
392 %!assert (cbrt (Inf), Inf) |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
393 %!assert (cbrt (-Inf), -Inf) |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
394 %!assert (cbrt (NaN), NaN) |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
395 %!assert (cbrt (2^300), 2^100) |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
396 %!assert (cbrt (125*2^300), 5*2^100) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
397 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
398 %!error cbrt () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
399 %!error cbrt (1, 2) |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
400 */ |
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
401 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
402 DEFUN (ceil, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
403 "-*- texinfo -*-\n\ |
3373 | 404 @deftypefn {Mapping Function} {} ceil (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
405 Return the smallest integer not less than @var{x}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
406 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
407 This is equivalent to rounding towards positive infinity.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
408 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
409 If @var{x} is complex, return\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
410 @code{ceil (real (@var{x})) + ceil (imag (@var{x})) * I}.\n\ |
10840 | 411 \n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
412 @example\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
413 @group\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
414 ceil ([-2.7, 2.7])\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
415 @result{} -2 3\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
416 @end group\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
417 @end example\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
418 @seealso{floor, round, fix}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
419 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
420 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
421 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
422 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
423 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
424 return octave_value (args(0).ceil ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
425 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
426 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
427 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
428 ## double precision |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
429 %!assert (ceil ([2, 1.1, -1.1, -1]), [2, 2, -1, -1]) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
430 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
431 ## complex double precison |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
432 %!assert (ceil ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i]), [2+2i, 2+2i, -1-i, -1-i]) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
433 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
434 ## single precision |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
435 %!assert (ceil (single ([2, 1.1, -1.1, -1])), single ([2, 2, -1, -1])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
436 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
437 ## complex single precision |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
438 %!assert (ceil (single ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i])), single ([2+2i, 2+2i, -1-i, -1-i])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
439 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
440 %!error ceil () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
441 %!error ceil (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
442 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
443 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
444 DEFUN (conj, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
445 "-*- texinfo -*-\n\ |
3321 | 446 @deftypefn {Mapping Function} {} conj (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
447 Return the complex conjugate of @var{z}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
448 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
449 The complex conjugate is defined as\n\ |
3321 | 450 @tex\n\ |
451 $\\bar{z} = x - iy$.\n\ | |
452 @end tex\n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
453 @ifnottex\n\ |
3321 | 454 @code{conj (@var{z})} = @var{x} - @var{i}@var{y}.\n\ |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
455 @end ifnottex\n\ |
5642 | 456 @seealso{real, imag}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
457 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
458 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
459 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
460 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
461 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
462 return octave_value (args(0).conj ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
463 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
464 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
465 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
466 %!assert (conj (1), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
467 %!assert (conj (i), -i) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
468 %!assert (conj (1+i), 1-i) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
469 %!assert (conj (1-i), 1+i) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
470 %!assert (conj ([-1, -i; -1+i, -1-i]), [-1, i; -1-i, -1+i]) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
471 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
472 %!assert (conj (single (1)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
473 %!assert (conj (single (i)), single (-i)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
474 %!assert (conj (single (1+i)), single (1-i)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
475 %!assert (conj (single (1-i)), single (1+i)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
476 %!assert (conj (single ([-1, -i; -1+i, -1-i])), single ([-1, i; -1-i, -1+i])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
477 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
478 %!error conj () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
479 %!error conj (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
480 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
481 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
482 DEFUN (cos, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
483 "-*- texinfo -*-\n\ |
3428 | 484 @deftypefn {Mapping Function} {} cos (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
485 Compute the cosine for each element of @var{x} in radians.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
486 @seealso{acos, cosd, cosh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
487 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
488 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
489 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
490 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
491 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
492 return octave_value (args(0).cos ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
493 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
494 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
495 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
496 %!shared rt2, rt3 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
497 %! rt2 = sqrt (2); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
498 %! rt3 = sqrt (3); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
499 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
500 %!test |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
501 %! x = [0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi]; |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
502 %! v = [1, rt3/2, rt2/2, 1/2, 0, -1/2, -rt2/2, -rt3/2, -1]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
503 %! assert (cos (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
504 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
505 %!test |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
506 %! rt2 = sqrt (2); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
507 %! rt3 = sqrt (3); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
508 %! x = single ([0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
509 %! v = single ([1, rt3/2, rt2/2, 1/2, 0, -1/2, -rt2/2, -rt3/2, -1]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
510 %! assert (cos (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
511 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
512 %!error cos () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
513 %!error cos (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
514 */ |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
515 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
516 DEFUN (cosh, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
517 "-*- texinfo -*-\n\ |
3428 | 518 @deftypefn {Mapping Function} {} cosh (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
519 Compute the hyperbolic cosine for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
520 @seealso{acosh, sinh, tanh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
521 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
522 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
523 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
524 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
525 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
526 return octave_value (args(0).cosh ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
527 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
528 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
529 /* |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
530 %!test |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
531 %! x = [0, pi/2*i, pi*i, 3*pi/2*i]; |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
532 %! v = [1, 0, -1, 0]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
533 %! assert (cosh (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
534 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
535 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
536 %! x = single ([0, pi/2*i, pi*i, 3*pi/2*i]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
537 %! v = single ([1, 0, -1, 0]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
538 %! assert (cosh (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
539 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
540 %!error cosh () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
541 %!error cosh (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
542 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
543 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
544 DEFUN (erf, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
545 "-*- texinfo -*-\n\ |
3321 | 546 @deftypefn {Mapping Function} {} erf (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
547 Compute the error function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
548 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
549 The error function is defined as\n\ |
3321 | 550 @tex\n\ |
551 $$\n\ | |
552 {\\rm erf} (z) = {2 \\over \\sqrt{\\pi}}\\int_0^z e^{-t^2} dt\n\ | |
553 $$\n\ | |
554 @end tex\n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
555 @ifnottex\n\ |
3321 | 556 \n\ |
9153
5247e89688e1
Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents:
9141
diff
changeset
|
557 @example\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
558 @group\n\ |
14437
62a2ef6c09a4
doc: Correct spacing of integrals in Info version of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
559 z\n\ |
62a2ef6c09a4
doc: Correct spacing of integrals in Info version of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
560 2 /\n\ |
62a2ef6c09a4
doc: Correct spacing of integrals in Info version of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
561 erf (z) = --------- * | e^(-t^2) dt\n\ |
62a2ef6c09a4
doc: Correct spacing of integrals in Info version of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
562 sqrt (pi) /\n\ |
62a2ef6c09a4
doc: Correct spacing of integrals in Info version of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
563 t=0\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
564 @end group\n\ |
9153
5247e89688e1
Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents:
9141
diff
changeset
|
565 @end example\n\ |
10840 | 566 \n\ |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
567 @end ifnottex\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
568 @seealso{erfc, erfcx, erfi, dawson, erfinv, erfcinv}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
569 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
570 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
571 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
572 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
573 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
574 return octave_value (args(0).erf ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
575 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
576 |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
577 /* |
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
578 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
579 %! a = -1i*sqrt (-1/(6.4187*6.4187)); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
580 %! assert (erf (a), erf (real (a))); |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
581 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
582 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
583 %! x = [0,.5,1]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
584 %! v = [0, .520499877813047, .842700792949715]; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
585 %! assert (erf (x), v, 1.e-10); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
586 %! assert (erf (-x), -v, 1.e-10); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
587 %! assert (erfc (x), 1-v, 1.e-10); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
588 %! assert (erfinv (v), x, 1.e-10); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
589 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
590 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
591 %! a = -1i*sqrt (single (-1/(6.4187*6.4187))); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
592 %! assert (erf (a), erf (real (a))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
593 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
594 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
595 %! x = single ([0,.5,1]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
596 %! v = single ([0, .520499877813047, .842700792949715]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
597 %! assert (erf (x), v, 1.e-6); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
598 %! assert (erf (-x), -v, 1.e-6); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
599 %! assert (erfc (x), 1-v, 1.e-6); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
600 %! assert (erfinv (v), x, 1.e-6); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
601 |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
602 %!test |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
603 %! x = [1+2i,-1+2i,1e-6+2e-6i,0+2i]; |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
604 %! v = [-0.53664356577857-5.04914370344703i, 0.536643565778565-5.04914370344703i, 0.112837916709965e-5+0.225675833419178e-5i, 18.5648024145755526i]; |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
605 %! assert (erf (x), v, -1.e-10); |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
606 %! assert (erf (-x), -v, -1.e-10); |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
607 %! assert (erfc (x), 1-v, -1.e-10); |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
608 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
609 %!error erf () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
610 %!error erf (1, 2) |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
611 */ |
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
612 |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
613 DEFUN (erfinv, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
614 "-*- texinfo -*-\n\ |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
615 @deftypefn {Mapping Function} {} erfinv (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
616 Compute the inverse error function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
617 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
618 The inverse error function is defined such that\n\ |
10840 | 619 \n\ |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
620 @example\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
621 erf (@var{y}) == @var{x}\n\ |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
622 @end example\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
623 @seealso{erf, erfc, erfcx, erfi, dawson, erfcinv}\n\ |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
624 @end deftypefn") |
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
625 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
626 if (args.length () != 1) |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
627 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
628 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
629 return octave_value (args(0).erfinv ()); |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
630 } |
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
631 |
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
632 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
633 ## middle region |
10049
44e889c67abe
mappers.cc: Change test tolerance from 1e-16 to eps.
Ben Abbott <bpabbott@mac.com>
parents:
9835
diff
changeset
|
634 %!assert (erf (erfinv ([-0.9 -0.3 0 0.4 0.8])), [-0.9 -0.3 0 0.4 0.8], eps) |
14771
10ed11922f19
maint: code cleanup for new erfcinv function.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
635 %!assert (erf (erfinv (single ([-0.9 -0.3 0 0.4 0.8]))), single ([-0.9 -0.3 0 0.4 0.8]), eps ("single")) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
636 ## tail region |
10049
44e889c67abe
mappers.cc: Change test tolerance from 1e-16 to eps.
Ben Abbott <bpabbott@mac.com>
parents:
9835
diff
changeset
|
637 %!assert (erf (erfinv ([-0.999 -0.99 0.9999 0.99999])), [-0.999 -0.99 0.9999 0.99999], eps) |
14771
10ed11922f19
maint: code cleanup for new erfcinv function.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
638 %!assert (erf (erfinv (single ([-0.999 -0.99 0.9999 0.99999]))), single ([-0.999 -0.99 0.9999 0.99999]), eps ("single")) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
639 ## backward - loss of accuracy |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
640 %!assert (erfinv (erf ([-3 -1 -0.4 0.7 1.3 2.8])), [-3 -1 -0.4 0.7 1.3 2.8], -1e-12) |
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
641 %!assert (erfinv (erf (single ([-3 -1 -0.4 0.7 1.3 2.8]))), single ([-3 -1 -0.4 0.7 1.3 2.8]), -1e-4) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
642 ## exceptional |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
643 %!assert (erfinv ([-1, 1, 1.1, -2.1]), [-Inf, Inf, NaN, NaN]) |
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
644 %!error erfinv (1+2i) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
645 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
646 %!error erfinv () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
647 %!error erfinv (1, 2) |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
648 */ |
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
649 |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
650 DEFUN (erfcinv, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
651 "-*- texinfo -*-\n\ |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
652 @deftypefn {Mapping Function} {} erfcinv (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
653 Compute the inverse complementary error function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
654 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
655 The inverse complementary error function is defined such that\n\ |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
656 \n\ |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
657 @example\n\ |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
658 erfc (@var{y}) == @var{x}\n\ |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
659 @end example\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
660 @seealso{erfc, erf, erfcx, erfi, dawson, erfinv}\n\ |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
661 @end deftypefn") |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
662 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
663 if (args.length () != 1) |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
664 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
665 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
666 return octave_value (args(0).erfcinv ()); |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
667 } |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
668 |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
669 /* |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
670 ## middle region |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
671 %!assert (erfc (erfcinv ([1.9 1.3 1 0.6 0.2])), [1.9 1.3 1 0.6 0.2], eps) |
14771
10ed11922f19
maint: code cleanup for new erfcinv function.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
672 %!assert (erfc (erfcinv (single ([1.9 1.3 1 0.6 0.2]))), single ([1.9 1.3 1 0.6 0.2]), eps ("single")) |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
673 ## tail region |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
674 %!assert (erfc (erfcinv ([0.001 0.01 1.9999 1.99999])), [0.001 0.01 1.9999 1.99999], eps) |
14771
10ed11922f19
maint: code cleanup for new erfcinv function.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
675 %!assert (erfc (erfcinv (single ([0.001 0.01 1.9999 1.99999]))), single ([0.001 0.01 1.9999 1.99999]), eps ("single")) |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
676 ## backward - loss of accuracy |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
677 %!assert (erfcinv (erfc ([-3 -1 -0.4 0.7 1.3 2.8])), [-3 -1 -0.4 0.7 1.3 2.8], -1e-12) |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
678 %!assert (erfcinv (erfc (single ([-3 -1 -0.4 0.7 1.3 2.8]))), single ([-3 -1 -0.4 0.7 1.3 2.8]), -1e-4) |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
679 ## exceptional |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
680 %!assert (erfcinv ([2, 0, -0.1, 2.1]), [-Inf, Inf, NaN, NaN]) |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
681 %!error erfcinv (1+2i) |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
682 |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
683 %!error erfcinv () |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
684 %!error erfcinv (1, 2) |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
685 */ |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14437
diff
changeset
|
686 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
687 DEFUN (erfc, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
688 "-*- texinfo -*-\n\ |
3321 | 689 @deftypefn {Mapping Function} {} erfc (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
690 Compute the complementary error function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
691 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
692 The complementary error function is defined as\n\ |
3321 | 693 @tex\n\ |
694 $1 - {\\rm erf} (z)$.\n\ | |
695 @end tex\n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
696 @ifnottex\n\ |
12654
20e64dab6896
doc: Correct spacing in erf and gamma documentation in INFO mode.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
697 @w{@code{1 - erf (@var{z})}}.\n\ |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
698 @end ifnottex\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
699 @seealso{erfcinv, erfcx, erfi, dawson, erf, erfinv}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
700 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
701 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
702 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
703 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
704 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
705 return octave_value (args(0).erfc ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
706 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
707 |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
708 /* |
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
709 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
710 %! a = -1i*sqrt (-1/(6.4187*6.4187)); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
711 %! assert (erfc (a), erfc (real (a))); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
712 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
713 %!error erfc () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
714 %!error erfc (1, 2) |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
715 */ |
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
716 |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
717 DEFUN (erfcx, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
718 "-*- texinfo -*-\n\ |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
719 @deftypefn {Mapping Function} {} erfcx (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
720 Compute the scaled complementary error function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
721 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
722 The scaled complementary error function is defined as\n\ |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
723 @tex\n\ |
12660
eae41900ca01
Use correct definition of erfcx in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12654
diff
changeset
|
724 $$\n\ |
eae41900ca01
Use correct definition of erfcx in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12654
diff
changeset
|
725 e^{z^2} {\\rm erfc} (z) \\equiv e^{z^2} (1 - {\\rm erf} (z))\n\ |
eae41900ca01
Use correct definition of erfcx in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12654
diff
changeset
|
726 $$\n\ |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
727 @end tex\n\ |
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
728 @ifnottex\n\ |
12660
eae41900ca01
Use correct definition of erfcx in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12654
diff
changeset
|
729 \n\ |
eae41900ca01
Use correct definition of erfcx in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12654
diff
changeset
|
730 @example\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
731 exp (z^2) * erfc (z)\n\ |
12660
eae41900ca01
Use correct definition of erfcx in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12654
diff
changeset
|
732 @end example\n\ |
eae41900ca01
Use correct definition of erfcx in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12654
diff
changeset
|
733 \n\ |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
734 @end ifnottex\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
735 @seealso{erfc, erf, erfi, dawson, erfinv, erfcinv}\n\ |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
736 @end deftypefn") |
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
737 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
738 if (args.length () != 1) |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
739 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
740 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
741 return octave_value (args(0).erfcx ()); |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
742 } |
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
743 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
744 /* |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
745 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
746 %!test |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
747 %! x = [1+2i,-1+2i,1e-6+2e-6i,0+2i]; |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
748 %! assert (erfcx (x), exp (x.^2) .* erfc(x), -1.e-10); |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
749 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
750 %!test |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
751 %! x = [100, 100+20i]; |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
752 %! v = [0.0056416137829894329, 0.0054246791754558-0.00108483153786434i]; |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
753 %! assert (erfcx (x), v, -1.e-10); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
754 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
755 %!error erfcx () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
756 %!error erfcx (1, 2) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
757 */ |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
758 |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
759 DEFUN (erfi, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
760 "-*- texinfo -*-\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
761 @deftypefn {Mapping Function} {} erfi (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
762 Compute the imaginary error function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
763 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
764 The imaginary error function is defined as\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
765 @tex\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
766 $$\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
767 -i {\\rm erf} (iz)\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
768 $$\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
769 @end tex\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
770 @ifnottex\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
771 \n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
772 @example\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
773 -i * erf (i*z)\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
774 @end example\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
775 \n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
776 @end ifnottex\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
777 @seealso{erfc, erf, erfcx, dawson, erfinv, erfcinv}\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
778 @end deftypefn") |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
779 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
780 if (args.length () != 1) |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
781 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
782 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
783 return octave_value (args(0).erfi ()); |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
784 } |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
785 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
786 /* |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
787 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
788 %!test |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
789 %! x = [-0.1, 0.1, 1, 1+2i,-1+2i,1e-6+2e-6i,0+2i]; |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
790 %! assert (erfi (x), -i * erf(i*x), -1.e-10); |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
791 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
792 %!error erfi () |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
793 %!error erfi (1, 2) |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
794 */ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
795 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
796 DEFUN (dawson, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
797 "-*- texinfo -*-\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
798 @deftypefn {Mapping Function} {} dawson (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
799 Compute the Dawson (scaled imaginary error) function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
800 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
801 The Dawson function is defined as\n\ |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
802 @tex\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
803 $$\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
804 {\\sqrt{\\pi} \\over 2} e^{-z^2} {\\rm erfi} (z) \\equiv -i {\\sqrt{\\pi} \\over 2} e^{-z^2} {\\rm erf} (iz)\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
805 $$\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
806 @end tex\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
807 @ifnottex\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
808 \n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
809 @example\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
810 (sqrt (pi) / 2) * exp (-z^2) * erfi (z)\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
811 @end example\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
812 \n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
813 @end ifnottex\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
814 @seealso{erfc, erf, erfcx, erfi, erfinv, erfcinv}\n\ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
815 @end deftypefn") |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
816 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
817 if (args.length () != 1) |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
818 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
819 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
820 return octave_value (args(0).dawson ()); |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
821 } |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
822 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
823 /* |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
824 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
825 %!test |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
826 %! x = [0.1, 1, 1+2i,-1+2i,1e-4+2e-4i,0+2i]; |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
827 %! v = [0.099335992397852861, 0.53807950691, -13.38892731648-11.828715104i, 13.38892731648-11.828715104i, 0.0001000000073333+0.000200000001333i, 48.160012114291i]; |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
828 %! assert (dawson (x), v, -1.e-10); |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
829 %! assert (dawson (-x), -v, -1.e-10); |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
830 |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
831 %!error dawson () |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
832 %!error dawson (1, 2) |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
833 */ |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15500
diff
changeset
|
834 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
835 DEFUN (exp, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
836 "-*- texinfo -*-\n\ |
3373 | 837 @deftypefn {Mapping Function} {} exp (@var{x})\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
838 Compute\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
839 @tex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
840 $e^{x}$\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
841 @end tex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
842 @ifnottex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
843 @code{e^x}\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
844 @end ifnottex\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
845 for each element of @var{x}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
846 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
847 To compute the matrix exponential, see @ref{Linear Algebra}.\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
848 @seealso{log}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
849 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
850 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
851 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
852 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
853 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
854 return octave_value (args(0).exp ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
855 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
856 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
857 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
858 %!assert (exp ([0, 1, -1, -1000]), [1, e, 1/e, 0], sqrt (eps)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
859 %!assert (exp (1+i), e * (cos (1) + sin (1) * i), sqrt (eps)) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
860 %!assert (exp (single ([0, 1, -1, -1000])), single ([1, e, 1/e, 0]), sqrt (eps ("single"))) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
861 %!assert (exp (single (1+i)), single (e * (cos (1) + sin (1) * i)), sqrt (eps ("single"))) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
862 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
863 %!assert (exp ([Inf, -Inf, NaN]), [Inf 0 NaN]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
864 %!assert (exp (single ([Inf, -Inf, NaN])), single ([Inf 0 NaN])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
865 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
866 %!error exp () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
867 %!error exp (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
868 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
869 |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
870 DEFUN (expm1, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
871 "-*- texinfo -*-\n\ |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
872 @deftypefn {Mapping Function} {} expm1 (@var{x})\n\ |
9167
1231b1762a9a
Simplify TeXinfo and eliminate use of @iftex in arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9165
diff
changeset
|
873 Compute\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
874 @tex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
875 $ e^{x} - 1 $\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
876 @end tex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
877 @ifnottex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
878 @code{exp (@var{x}) - 1}\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
879 @end ifnottex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
880 accurately in the neighborhood of zero.\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
881 @seealso{exp}\n\ |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
882 @end deftypefn") |
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
883 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
884 if (args.length () != 1) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
885 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
886 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
887 return octave_value (args(0).expm1 ()); |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
888 } |
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
889 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
890 /* |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
891 %!assert (expm1 (2*eps), 2*eps, 1e-29) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
892 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
893 %!assert (expm1 ([Inf, -Inf, NaN]), [Inf -1 NaN]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
894 %!assert (expm1 (single ([Inf, -Inf, NaN])), single ([Inf -1 NaN])) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
895 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
896 %!error expm1 () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
897 %!error expm1 (1, 2) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
898 */ |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
899 |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
900 DEFUN (isfinite, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
901 "-*- texinfo -*-\n\ |
19117
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
902 @deftypefn {Mapping Function} {} isfinite (@var{x})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
903 Return a logical array which is true where the elements of @var{x} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
904 finite values and false where they are not.\n\ |
19117
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
905 \n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
906 For example:\n\ |
3369 | 907 \n\ |
908 @example\n\ | |
909 @group\n\ | |
19117
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
910 isfinite ([13, Inf, NA, NaN])\n\ |
5016 | 911 @result{} [ 1, 0, 0, 0 ]\n\ |
3369 | 912 @end group\n\ |
913 @end example\n\ | |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
914 @seealso{isinf, isnan, isna}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
915 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
916 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
917 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
918 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
919 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
920 return octave_value (args(0).finite ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
921 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
922 |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
923 /* |
19117
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
924 %!assert (!isfinite (Inf)) |
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
925 %!assert (!isfinite (NaN)) |
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
926 %!assert (isfinite (rand (1,10))) |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
927 |
19117
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
928 %!assert (!isfinite (single (Inf))) |
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
929 %!assert (!isfinite (single (NaN))) |
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
930 %!assert (isfinite (single (rand (1,10)))) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
931 |
19117
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
932 %!error isfinite () |
a4c226a963c5
Deprecate finite in favor of isfinite.
Rik <rik@octave.org>
parents:
18812
diff
changeset
|
933 %!error isfinite (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
934 */ |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
935 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
936 DEFUN (fix, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
937 "-*- texinfo -*-\n\ |
3373 | 938 @deftypefn {Mapping Function} {} fix (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
939 Truncate fractional portion of @var{x} and return the integer portion.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
940 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
941 This is equivalent to rounding towards zero. If @var{x} is complex, return\n\ |
3321 | 942 @code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.\n\ |
10840 | 943 \n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
944 @example\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
945 @group\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
946 fix ([-2.7, 2.7])\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
947 @result{} -2 2\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
948 @end group\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
949 @end example\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
950 @seealso{ceil, floor, round}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
951 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
952 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
953 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
954 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
955 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
956 return octave_value (args(0).fix ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
957 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
958 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
959 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
960 %!assert (fix ([1.1, 1, -1.1, -1]), [1, 1, -1, -1]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
961 %!assert (fix ([1.1+1.1i, 1+i, -1.1-1.1i, -1-i]), [1+i, 1+i, -1-i, -1-i]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
962 %!assert (fix (single ([1.1, 1, -1.1, -1])), single ([1, 1, -1, -1])) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
963 %!assert (fix (single ([1.1+1.1i, 1+i, -1.1-1.1i, -1-i])), single ([1+i, 1+i, -1-i, -1-i])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
964 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
965 %!error fix () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
966 %!error fix (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
967 */ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
968 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
969 DEFUN (floor, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
970 "-*- texinfo -*-\n\ |
3373 | 971 @deftypefn {Mapping Function} {} floor (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
972 Return the largest integer not greater than @var{x}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
973 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
974 This is equivalent to rounding towards negative infinity. If @var{x} is\n\ |
3321 | 975 complex, return @code{floor (real (@var{x})) + floor (imag (@var{x})) * I}.\n\ |
10840 | 976 \n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
977 @example\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
978 @group\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
979 floor ([-2.7, 2.7])\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
980 @result{} -3 2\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
981 @end group\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
982 @end example\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
983 @seealso{ceil, round, fix}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
984 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
985 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
986 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
987 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
988 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
989 return octave_value (args(0).floor ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
990 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
991 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
992 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
993 %!assert (floor ([2, 1.1, -1.1, -1]), [2, 1, -2, -1]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
994 %!assert (floor ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i]), [2+2i, 1+i, -2-2i, -1-i]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
995 %!assert (floor (single ([2, 1.1, -1.1, -1])), single ([2, 1, -2, -1])) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
996 %!assert (floor (single ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i])), single ([2+2i, 1+i, -2-2i, -1-i])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
997 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
998 %!error floor () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
999 %!error floor (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1000 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1001 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1002 DEFUN (gamma, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1003 "-*- texinfo -*-\n\ |
3321 | 1004 @deftypefn {Mapping Function} {} gamma (@var{z})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1005 Compute the Gamma function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1006 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1007 The Gamma function is defined as\n\ |
3321 | 1008 @tex\n\ |
1009 $$\n\ | |
1010 \\Gamma (z) = \\int_0^\\infty t^{z-1} e^{-t} dt.\n\ | |
1011 $$\n\ | |
1012 @end tex\n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
1013 @ifnottex\n\ |
3321 | 1014 \n\ |
1015 @example\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
9041
diff
changeset
|
1016 @group\n\ |
14437
62a2ef6c09a4
doc: Correct spacing of integrals in Info version of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
1017 infinity\n\ |
62a2ef6c09a4
doc: Correct spacing of integrals in Info version of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
1018 /\n\ |
3321 | 1019 gamma (z) = | t^(z-1) exp (-t) dt.\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1020 /\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1021 t=0\n\ |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
9041
diff
changeset
|
1022 @end group\n\ |
3321 | 1023 @end example\n\ |
10840 | 1024 \n\ |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
1025 @end ifnottex\n\ |
19151
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1026 \n\ |
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1027 Programming Note: The gamma function can grow quite large even for small\n\ |
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1028 input values. In many cases it may be preferable to use the natural\n\ |
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1029 logarithm of the gamma function (@code{gammaln}) in calculations to minimize\n\ |
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1030 loss of precision. The final result is then\n\ |
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1031 @code{exp (@var{result_using_gammaln}).}\n\ |
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1032 @seealso{gammainc, gammaln, factorial}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1033 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1034 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1035 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1036 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1037 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1038 return octave_value (args(0).gamma ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1039 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1040 |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1041 /* |
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1042 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1043 %! a = -1i*sqrt (-1/(6.4187*6.4187)); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1044 %! assert (gamma (a), gamma (real (a))); |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1045 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1046 %!test |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1047 %! x = [.5, 1, 1.5, 2, 3, 4, 5]; |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1048 %! v = [sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1049 %! assert (gamma (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1050 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1051 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1052 %! a = single (-1i*sqrt (-1/(6.4187*6.4187))); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1053 %! assert (gamma (a), gamma (real (a))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1054 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1055 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1056 %! x = single ([.5, 1, 1.5, 2, 3, 4, 5]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1057 %! v = single ([sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1058 %! assert (gamma (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1059 |
10903
9f0f1a89c704
Add new %!tests for negative integer arguments to gamma, lgamma.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
1060 %!test |
17708
f10b7a578e2c
Correct return values of gamma() (see Numerical, item 3 on Projects page).
Craig Hudson <c_hudson_phd@hotmail.com>
parents:
16816
diff
changeset
|
1061 %! ## Test exceptional values |
f10b7a578e2c
Correct return values of gamma() (see Numerical, item 3 on Projects page).
Craig Hudson <c_hudson_phd@hotmail.com>
parents:
16816
diff
changeset
|
1062 %! x = [-Inf, -1, -0, 0, 1, Inf, NaN]; |
19357
c6437824681c
improve Matlab compatibility for gamma function (bug #43551)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
1063 %! v = [Inf, Inf, -Inf, Inf, 1, Inf, NaN]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1064 %! assert (gamma (x), v); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1065 %! assert (gamma (single (x)), single (v)); |
10903
9f0f1a89c704
Add new %!tests for negative integer arguments to gamma, lgamma.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
1066 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1067 %!error gamma () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1068 %!error gamma (1, 2) |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1069 */ |
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1070 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1071 DEFUN (imag, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1072 "-*- texinfo -*-\n\ |
3321 | 1073 @deftypefn {Mapping Function} {} imag (@var{z})\n\ |
1074 Return the imaginary part of @var{z} as a real number.\n\ | |
5642 | 1075 @seealso{real, conj}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1076 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1077 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1078 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1079 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1080 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1081 return octave_value (args(0).imag ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1082 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1083 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1084 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1085 %!assert (imag (1), 0) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1086 %!assert (imag (i), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1087 %!assert (imag (1+i), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1088 %!assert (imag ([i, 1; 1, i]), full (eye (2))) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1089 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1090 %!assert (imag (single (1)), single (0)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1091 %!assert (imag (single (i)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1092 %!assert (imag (single (1+i)), single (1)) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1093 %!assert (imag (single ([i, 1; 1, i])), full (eye (2,"single"))) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1094 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1095 %!error imag () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1096 %!error imag (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1097 */ |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1098 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1099 DEFUNX ("isalnum", Fisalnum, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1100 "-*- texinfo -*-\n\ |
3361 | 1101 @deftypefn {Mapping Function} {} isalnum (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1102 Return a logical array which is true where the elements of @var{s} are\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1103 letters or digits and false where they are not.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1104 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1105 This is equivalent to (@code{isalpha (@var{s}) | isdigit (@var{s})}).\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1106 @seealso{isalpha, isdigit, ispunct, isspace, iscntrl}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1107 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1108 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1109 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1110 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1111 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1112 return octave_value (args(0).xisalnum ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1113 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1114 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1115 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1116 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1117 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1118 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1119 %! result(toascii ("A":"Z") + 1) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1120 %! result(toascii ("0":"9") + 1) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1121 %! result(toascii ("a":"z") + 1) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1122 %! assert (isalnum (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1123 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1124 %!error isalnum () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1125 %!error isalnum (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1126 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1127 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1128 DEFUNX ("isalpha", Fisalpha, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1129 "-*- texinfo -*-\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1130 @deftypefn {Mapping Function} {} isalpha (@var{s})\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1131 Return a logical array which is true where the elements of @var{s} are\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1132 letters and false where they are not.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1133 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1134 This is equivalent to (@code{islower (@var{s}) | isupper (@var{s})}).\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1135 @seealso{isdigit, ispunct, isspace, iscntrl, isalnum, islower, isupper}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1136 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1137 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1138 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1139 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1140 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1141 return octave_value (args(0).xisalpha ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1142 } |
2089 | 1143 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1144 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1145 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1146 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1147 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1148 %! result(toascii ("A":"Z") + 1) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1149 %! result(toascii ("a":"z") + 1) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1150 %! assert (isalpha (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1151 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1152 %!error isalpha () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1153 %!error isalpha (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1154 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1155 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1156 DEFUNX ("isascii", Fisascii, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1157 "-*- texinfo -*-\n\ |
3361 | 1158 @deftypefn {Mapping Function} {} isascii (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1159 Return a logical array which is true where the elements of @var{s} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1160 ASCII characters (in the range 0 to 127 decimal) and false where they are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1161 not.\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1162 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1163 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1164 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1165 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1166 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1167 return octave_value (args(0).xisascii ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1168 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1169 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1170 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1171 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1172 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1173 %! result = true (1, 128); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1174 %! assert (isascii (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1175 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1176 %!error isascii () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1177 %!error isascii (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1178 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1179 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1180 DEFUNX ("iscntrl", Fiscntrl, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1181 "-*- texinfo -*-\n\ |
3361 | 1182 @deftypefn {Mapping Function} {} iscntrl (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1183 Return a logical array which is true where the elements of @var{s} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1184 control characters and false where they are not.\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1185 @seealso{ispunct, isspace, isalpha, isdigit}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1186 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1187 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1188 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1189 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1190 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1191 return octave_value (args(0).xiscntrl ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1192 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1193 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1194 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1195 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1196 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1197 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1198 %! result(1:32) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1199 %! result(128) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1200 %! assert (iscntrl (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1201 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1202 %!error iscntrl () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1203 %!error iscntrl (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1204 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1205 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1206 DEFUNX ("isdigit", Fisdigit, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1207 "-*- texinfo -*-\n\ |
3361 | 1208 @deftypefn {Mapping Function} {} isdigit (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1209 Return a logical array which is true where the elements of @var{s} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1210 decimal digits (0-9) and false where they are not.\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1211 @seealso{isxdigit, isalpha, isletter, ispunct, isspace, iscntrl}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1212 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1213 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1214 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1215 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1216 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1217 return octave_value (args(0).xisdigit ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1218 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1219 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1220 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1221 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1222 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1223 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1224 %! result(toascii ("0":"9") + 1) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1225 %! assert (isdigit (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1226 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1227 %!error isdigit () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1228 %!error isdigit (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1229 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1230 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1231 DEFUN (isinf, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1232 "-*- texinfo -*-\n\ |
3369 | 1233 @deftypefn {Mapping Function} {} isinf (@var{x})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1234 Return a logical array which is true where the elements of @var{x} are\n\ |
20183
4e7f12a763cd
doc: Remove typo of same word twice in a row.
Rik <rik@octave.org>
parents:
20172
diff
changeset
|
1235 infinite and false where they are not.\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1236 \n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1237 For example:\n\ |
3369 | 1238 \n\ |
1239 @example\n\ | |
1240 @group\n\ | |
4025 | 1241 isinf ([13, Inf, NA, NaN])\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1242 @result{} [ 0, 1, 0, 0 ]\n\ |
3369 | 1243 @end group\n\ |
1244 @end example\n\ | |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1245 @seealso{isfinite, isnan, isna}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1246 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1247 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1248 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1249 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1250 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1251 return octave_value (args(0).isinf ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1252 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1253 |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1254 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1255 %!assert (isinf (Inf)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1256 %!assert (!isinf (NaN)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1257 %!assert (!isinf (NA)) |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14817
diff
changeset
|
1258 %!assert (isinf (rand (1,10)), false (1,10)) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1259 %!assert (isinf ([NaN -Inf -1 0 1 Inf NA]), [false, true, false, false, false, true, false]) |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1260 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1261 %!assert (isinf (single (Inf))) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1262 %!assert (!isinf (single (NaN))) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1263 %!assert (!isinf (single (NA))) |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14817
diff
changeset
|
1264 %!assert (isinf (single (rand (1,10))), false (1,10)) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1265 %!assert (isinf (single ([NaN -Inf -1 0 1 Inf NA])), [false, true, false, false, false, true, false]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1266 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1267 %!error isinf () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1268 %!error isinf (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1269 */ |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1270 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1271 DEFUNX ("isgraph", Fisgraph, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1272 "-*- texinfo -*-\n\ |
3361 | 1273 @deftypefn {Mapping Function} {} isgraph (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1274 Return a logical array which is true where the elements of @var{s} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1275 printable characters (but not the space character) and false where they are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1276 not.\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1277 @seealso{isprint}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1278 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1279 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1280 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1281 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1282 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1283 return octave_value (args(0).xisgraph ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1284 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1285 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1286 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1287 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1288 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1289 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1290 %! result(34:127) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1291 %! assert (isgraph (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1292 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1293 %!error isgraph () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1294 %!error isgraph (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1295 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1296 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1297 DEFUNX ("islower", Fislower, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1298 "-*- texinfo -*-\n\ |
3361 | 1299 @deftypefn {Mapping Function} {} islower (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1300 Return a logical array which is true where the elements of @var{s} are\n\ |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12636
diff
changeset
|
1301 lowercase letters and false where they are not.\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1302 @seealso{isupper, isalpha, isletter, isalnum}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1303 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1304 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1305 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1306 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1307 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1308 return octave_value (args(0).xislower ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1309 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1310 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1311 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1312 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1313 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1314 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1315 %! result(toascii ("a":"z") + 1) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1316 %! assert (islower (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1317 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1318 %!error islower () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1319 %!error islower (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1320 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1321 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1322 DEFUN (isna, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1323 "-*- texinfo -*-\n\ |
4025 | 1324 @deftypefn {Mapping Function} {} isna (@var{x})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1325 Return a logical array which is true where the elements of @var{x} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1326 NA (missing) values and false where they are not.\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1327 \n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1328 For example:\n\ |
4025 | 1329 \n\ |
1330 @example\n\ | |
1331 @group\n\ | |
6218 | 1332 isna ([13, Inf, NA, NaN])\n\ |
4025 | 1333 @result{} [ 0, 0, 1, 0 ]\n\ |
1334 @end group\n\ | |
1335 @end example\n\ | |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1336 @seealso{isnan, isinf, isfinite}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1337 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1338 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1339 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1340 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1341 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1342 return octave_value (args(0).isna ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1343 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1344 |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1345 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1346 %!assert (!isna (Inf)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1347 %!assert (!isna (NaN)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1348 %!assert (isna (NA)) |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14817
diff
changeset
|
1349 %!assert (isna (rand (1,10)), false (1,10)) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1350 %!assert (isna ([NaN -Inf -1 0 1 Inf NA]), [false, false, false, false, false, false, true]) |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1351 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1352 %!assert (!isna (single (Inf))) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1353 %!assert (!isna (single (NaN))) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1354 %!assert (isna (single (NA))) |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14817
diff
changeset
|
1355 %!assert (isna (single (rand (1,10))), false (1,10)) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1356 %!assert (isna (single ([NaN -Inf -1 0 1 Inf NA])), [false, false, false, false, false, false, true]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1357 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1358 %!error isna () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1359 %!error isna (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1360 */ |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1361 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1362 DEFUN (isnan, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1363 "-*- texinfo -*-\n\ |
3369 | 1364 @deftypefn {Mapping Function} {} isnan (@var{x})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1365 Return a logical array which is true where the elements of @var{x} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1366 NaN values and false where they are not.\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1367 \n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1368 NA values are also considered NaN values. For example:\n\ |
3369 | 1369 \n\ |
1370 @example\n\ | |
1371 @group\n\ | |
4025 | 1372 isnan ([13, Inf, NA, NaN])\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1373 @result{} [ 0, 0, 1, 1 ]\n\ |
3369 | 1374 @end group\n\ |
1375 @end example\n\ | |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1376 @seealso{isna, isinf, isfinite}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1377 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1378 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1379 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1380 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1381 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1382 return octave_value (args(0).isnan ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1383 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1384 |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1385 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1386 %!assert (!isnan (Inf)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1387 %!assert (isnan (NaN)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1388 %!assert (isnan (NA)) |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14817
diff
changeset
|
1389 %!assert (isnan (rand (1,10)), false (1,10)) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1390 %!assert (isnan ([NaN -Inf -1 0 1 Inf NA]), [true, false, false, false, false, false, true]) |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1391 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1392 %!assert (!isnan (single (Inf))) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1393 %!assert (isnan (single (NaN))) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1394 %!assert (isnan (single (NA))) |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14817
diff
changeset
|
1395 %!assert (isnan (single (rand (1,10))), false (1,10)) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1396 %!assert (isnan (single ([NaN -Inf -1 0 1 Inf NA])), [true, false, false, false, false, false, true]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1397 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1398 %!error isnan () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1399 %!error isnan (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1400 */ |
7814
87865ed7405f
Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents:
7667
diff
changeset
|
1401 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1402 DEFUNX ("isprint", Fisprint, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1403 "-*- texinfo -*-\n\ |
3361 | 1404 @deftypefn {Mapping Function} {} isprint (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1405 Return a logical array which is true where the elements of @var{s} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1406 printable characters (including the space character) and false where they\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1407 are not.\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1408 @seealso{isgraph}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1409 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1410 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1411 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1412 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1413 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1414 return octave_value (args(0).xisprint ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1415 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1416 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1417 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1418 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1419 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1420 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1421 %! result(33:127) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1422 %! assert (isprint (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1423 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1424 %!error isprint () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1425 %!error isprint (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1426 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1427 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1428 DEFUNX ("ispunct", Fispunct, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1429 "-*- texinfo -*-\n\ |
3361 | 1430 @deftypefn {Mapping Function} {} ispunct (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1431 Return a logical array which is true where the elements of @var{s} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1432 punctuation characters and false where they are not.\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1433 @seealso{isalpha, isdigit, isspace, iscntrl}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1434 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1435 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1436 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1437 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1438 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1439 return octave_value (args(0).xispunct ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1440 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1441 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1442 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1443 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1444 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1445 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1446 %! result(34:48) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1447 %! result(59:65) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1448 %! result(92:97) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1449 %! result(124:127) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1450 %! assert (ispunct (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1451 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1452 %!error ispunct () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1453 %!error ispunct (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1454 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1455 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1456 DEFUNX ("isspace", Fisspace, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1457 "-*- texinfo -*-\n\ |
3361 | 1458 @deftypefn {Mapping Function} {} isspace (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1459 Return a logical array which is true where the elements of @var{s} are\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1460 whitespace characters (space, formfeed, newline, carriage return, tab, and\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1461 vertical tab) and false where they are not.\n\ |
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1462 @seealso{iscntrl, ispunct, isalpha, isdigit}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1463 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1464 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1465 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1466 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1467 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1468 return octave_value (args(0).xisspace ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1469 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1470 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1471 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1472 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1473 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1474 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1475 %! result(toascii (" \f\n\r\t\v") + 1) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1476 %! assert (isspace (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1477 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1478 %!error isspace () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1479 %!error isspace (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1480 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1481 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1482 DEFUNX ("isupper", Fisupper, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1483 "-*- texinfo -*-\n\ |
3361 | 1484 @deftypefn {Mapping Function} {} isupper (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1485 Return a logical array which is true where the elements of @var{s} are\n\ |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12636
diff
changeset
|
1486 uppercase letters and false where they are not.\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1487 @seealso{islower, isalpha, isletter, isalnum}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1488 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1489 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1490 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1491 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1492 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1493 return octave_value (args(0).xisupper ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1494 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1495 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1496 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1497 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1498 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1499 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1500 %! result(toascii ("A":"Z") + 1) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1501 %! assert (isupper (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1502 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1503 %!error isupper () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1504 %!error isupper (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1505 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1506 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1507 DEFUNX ("isxdigit", Fisxdigit, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1508 "-*- texinfo -*-\n\ |
3361 | 1509 @deftypefn {Mapping Function} {} isxdigit (@var{s})\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1510 Return a logical array which is true where the elements of @var{s} are\n\ |
11591
1d13679b587e
Use @nospell macro on certain words in docstrings.
Rik <octave@nomad.inbox5.com>
parents:
11586
diff
changeset
|
1511 hexadecimal digits (0-9 and @nospell{a-fA-F}).\n\ |
11431
0d9640d755b1
Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents:
11327
diff
changeset
|
1512 @seealso{isdigit}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1513 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1514 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1515 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1516 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1517 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1518 return octave_value (args(0).xisxdigit ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1519 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1520 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1521 /* |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1522 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
1523 %! charset = char (0:127); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1524 %! result = false (1, 128); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1525 %! result(toascii ("A":"F") + 1) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1526 %! result(toascii ("0":"9") + 1) = true; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1527 %! result(toascii ("a":"f") + 1) = true; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1528 %! assert (isxdigit (charset), result); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1529 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1530 %!error isxdigit () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1531 %!error isxdigit (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1532 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1533 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1534 DEFUN (lgamma, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1535 "-*- texinfo -*-\n\ |
19151
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1536 @deftypefn {Mapping Function} {} gammaln (@var{x})\n\ |
e09318118fd6
doc: Add note to gamma docstring about using gammaln when input is large.
Rik <rik@octave.org>
parents:
19117
diff
changeset
|
1537 @deftypefnx {Mapping Function} {} lgamma (@var{x})\n\ |
7601
8a939b217863
Treat negative values to lgamma and beta correctly
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1538 Return the natural logarithm of the gamma function of @var{x}.\n\ |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8084
diff
changeset
|
1539 @seealso{gamma, gammainc}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1540 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1541 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1542 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1543 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1544 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1545 return octave_value (args(0).lgamma ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1546 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1547 |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1548 /* |
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1549 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1550 %! a = -1i*sqrt (-1/(6.4187*6.4187)); |
19275
653ed3a6ba83
Use gammaln in preference to lgamma in core Octave code.
Rik <rik@octave.org>
parents:
19242
diff
changeset
|
1551 %! assert (gammaln (a), gammaln (real (a))); |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1552 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1553 %!test |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1554 %! x = [.5, 1, 1.5, 2, 3, 4, 5]; |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1555 %! v = [sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]; |
19275
653ed3a6ba83
Use gammaln in preference to lgamma in core Octave code.
Rik <rik@octave.org>
parents:
19242
diff
changeset
|
1556 %! assert (gammaln (x), log (v), sqrt (eps)) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1557 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1558 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1559 %! a = single (-1i*sqrt (-1/(6.4187*6.4187))); |
19275
653ed3a6ba83
Use gammaln in preference to lgamma in core Octave code.
Rik <rik@octave.org>
parents:
19242
diff
changeset
|
1560 %! assert (gammaln (a), gammaln (real (a))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1561 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1562 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1563 %! x = single ([.5, 1, 1.5, 2, 3, 4, 5]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1564 %! v = single ([sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]); |
19275
653ed3a6ba83
Use gammaln in preference to lgamma in core Octave code.
Rik <rik@octave.org>
parents:
19242
diff
changeset
|
1565 %! assert (gammaln (x), log (v), sqrt (eps ("single"))) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1566 |
10903
9f0f1a89c704
Add new %!tests for negative integer arguments to gamma, lgamma.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
1567 %!test |
9f0f1a89c704
Add new %!tests for negative integer arguments to gamma, lgamma.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
1568 %! x = [-1, 0, 1, Inf]; |
9f0f1a89c704
Add new %!tests for negative integer arguments to gamma, lgamma.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
1569 %! v = [Inf, Inf, 0, Inf]; |
19275
653ed3a6ba83
Use gammaln in preference to lgamma in core Octave code.
Rik <rik@octave.org>
parents:
19242
diff
changeset
|
1570 %! assert (gammaln (x), v); |
653ed3a6ba83
Use gammaln in preference to lgamma in core Octave code.
Rik <rik@octave.org>
parents:
19242
diff
changeset
|
1571 %! assert (gammaln (single (x)), single (v)); |
10903
9f0f1a89c704
Add new %!tests for negative integer arguments to gamma, lgamma.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
1572 |
19275
653ed3a6ba83
Use gammaln in preference to lgamma in core Octave code.
Rik <rik@octave.org>
parents:
19242
diff
changeset
|
1573 %!error gammaln () |
653ed3a6ba83
Use gammaln in preference to lgamma in core Octave code.
Rik <rik@octave.org>
parents:
19242
diff
changeset
|
1574 %!error gammaln (1,2) |
7667
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1575 */ |
fb3a6c53c2b2
Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
1576 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1577 DEFUN (log, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1578 "-*- texinfo -*-\n\ |
3321 | 1579 @deftypefn {Mapping Function} {} log (@var{x})\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1580 Compute the natural logarithm,\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1581 @tex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1582 $\\ln{(x)},$\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1583 @end tex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1584 @ifnottex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1585 @code{ln (@var{x})},\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1586 @end ifnottex\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1587 for each element of @var{x}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1588 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1589 To compute the matrix logarithm, see @ref{Linear Algebra}.\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1590 @seealso{exp, log1p, log2, log10, logspace}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1591 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1592 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1593 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1594 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1595 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1596 return octave_value (args(0).log ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1597 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1598 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1599 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1600 %!assert (log ([1, e, e^2]), [0, 1, 2], sqrt (eps)) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1601 %!assert (log ([-0.5, -1.5, -2.5]), log ([0.5, 1.5, 2.5]) + pi*1i, sqrt (eps)) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1602 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1603 %!assert (log (single ([1, e, e^2])), single ([0, 1, 2]), sqrt (eps ("single"))) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1604 %!assert (log (single ([-0.5, -1.5, -2.5])), single (log ([0.5, 1.5, 2.5]) + pi*1i), 4*eps ("single")) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1605 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1606 %!error log () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1607 %!error log (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1608 */ |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1609 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1610 DEFUN (log10, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1611 "-*- texinfo -*-\n\ |
3321 | 1612 @deftypefn {Mapping Function} {} log10 (@var{x})\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1613 Compute the base-10 logarithm of each element of @var{x}.\n\ |
5642 | 1614 @seealso{log, log2, logspace, exp}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1615 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1616 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1617 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1618 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1619 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1620 return octave_value (args(0).log10 ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1621 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1622 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1623 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1624 %!assert (log10 ([0.01, 0.1, 1, 10, 100]), [-2, -1, 0, 1, 2], sqrt (eps)) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1625 %!assert (log10 (single ([0.01, 0.1, 1, 10, 100])), single ([-2, -1, 0, 1, 2]), sqrt (eps ("single"))) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1626 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1627 %!error log10 () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1628 %!error log10 (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1629 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1630 |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1631 DEFUN (log1p, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1632 "-*- texinfo -*-\n\ |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1633 @deftypefn {Mapping Function} {} log1p (@var{x})\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1634 Compute\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1635 @tex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1636 $\\ln{(1 + x)}$\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1637 @end tex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1638 @ifnottex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1639 @code{log (1 + @var{x})}\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1640 @end ifnottex\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1641 accurately in the neighborhood of zero.\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1642 @seealso{log, exp, expm1}\n\ |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1643 @end deftypefn") |
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1644 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1645 if (args.length () != 1) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1646 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1647 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1648 return octave_value (args(0).log1p ()); |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1649 } |
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1650 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1651 /* |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1652 %!assert (log1p ([0, 2*eps, -2*eps]), [0, 2*eps, -2*eps], 1e-29) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1653 %!assert (log1p (single ([0, 2*eps, -2*eps])), single ([0, 2*eps, -2*eps]), 1e-29) |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1654 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1655 %!error log1p () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1656 %!error log1p (1, 2) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1657 */ |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1658 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1659 DEFUN (real, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1660 "-*- texinfo -*-\n\ |
3321 | 1661 @deftypefn {Mapping Function} {} real (@var{z})\n\ |
1662 Return the real part of @var{z}.\n\ | |
5642 | 1663 @seealso{imag, conj}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1664 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1665 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1666 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1667 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1668 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1669 return octave_value (args(0).real ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1670 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1671 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1672 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1673 %!assert (real (1), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1674 %!assert (real (i), 0) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1675 %!assert (real (1+i), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1676 %!assert (real ([1, i; i, 1]), full (eye (2))) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1677 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1678 %!assert (real (single (1)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1679 %!assert (real (single (i)), single (0)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1680 %!assert (real (single (1+i)), single (1)) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1681 %!assert (real (single ([1, i; i, 1])), full (eye (2,"single"))) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1682 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1683 %!error real () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1684 %!error real (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1685 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1686 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1687 DEFUN (round, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1688 "-*- texinfo -*-\n\ |
3321 | 1689 @deftypefn {Mapping Function} {} round (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1690 Return the integer nearest to @var{x}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1691 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1692 If @var{x} is complex, return\n\ |
13929
9cae456085c2
Grammarcheck of documentation before 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
13915
diff
changeset
|
1693 @code{round (real (@var{x})) + round (imag (@var{x})) * I}. If there\n\ |
13138
5a3983cb9912
Mention roundb in round's docstring
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12894
diff
changeset
|
1694 are two nearest integers, return the one further away from zero.\n\ |
10840 | 1695 \n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1696 @example\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1697 @group\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1698 round ([-2.7, 2.7])\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1699 @result{} -3 3\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1700 @end group\n\ |
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1701 @end example\n\ |
13138
5a3983cb9912
Mention roundb in round's docstring
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12894
diff
changeset
|
1702 @seealso{ceil, floor, fix, roundb}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1703 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1704 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1705 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1706 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1707 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1708 return octave_value (args(0).round ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1709 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1710 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1711 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1712 %!assert (round (1), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1713 %!assert (round (1.1), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1714 %!assert (round (5.5), 6) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1715 %!assert (round (i), i) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1716 %!assert (round (2.5+3.5i), 3+4i) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1717 %!assert (round (-2.6), -3) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1718 %!assert (round ([1.1, -2.4; -3.7, 7.1]), [1, -2; -4, 7]) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1719 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1720 %!assert (round (single (1)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1721 %!assert (round (single (1.1)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1722 %!assert (round (single (5.5)), single (6)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1723 %!assert (round (single (i)), single (i)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1724 %!assert (round (single (2.5+3.5i)), single (3+4i)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1725 %!assert (round (single (-2.6)), single (-3)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1726 %!assert (round (single ([1.1, -2.4; -3.7, 7.1])), single ([1, -2; -4, 7])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1727 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1728 %!error round () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1729 %!error round (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1730 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1731 |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
1732 DEFUN (roundb, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1733 "-*- texinfo -*-\n\ |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
1734 @deftypefn {Mapping Function} {} roundb (@var{x})\n\ |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
9041
diff
changeset
|
1735 Return the integer nearest to @var{x}. If there are two nearest\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1736 integers, return the even one (banker's rounding).\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1737 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1738 If @var{x} is complex,\n\ |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
1739 return @code{roundb (real (@var{x})) + roundb (imag (@var{x})) * I}.\n\ |
9141
c1fff751b5a8
Update section 17.1 (Utility Functions) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9065
diff
changeset
|
1740 @seealso{round}\n\ |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
1741 @end deftypefn") |
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
1742 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1743 if (args.length () != 1) |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
1744 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1745 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1746 return octave_value (args(0).roundb ()); |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
1747 } |
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
1748 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1749 /* |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1750 %!assert (roundb (1), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1751 %!assert (roundb (1.1), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1752 %!assert (roundb (1.5), 2) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1753 %!assert (roundb (4.5), 4) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1754 %!assert (roundb (i), i) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1755 %!assert (roundb (2.5+3.5i), 2+4i) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1756 %!assert (roundb (-2.6), -3) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1757 %!assert (roundb ([1.1, -2.4; -3.7, 7.1]), [1, -2; -4, 7]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1758 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1759 %!assert (roundb (single (1)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1760 %!assert (roundb (single (1.1)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1761 %!assert (roundb (single (1.5)), single (2)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1762 %!assert (roundb (single (4.5)), single (4)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1763 %!assert (roundb (single (i)), single (i)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1764 %!assert (roundb (single (2.5+3.5i)), single (2+4i)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1765 %!assert (roundb (single (-2.6)), single (-3)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1766 %!assert (roundb (single ([1.1, -2.4; -3.7, 7.1])), single ([1, -2; -4, 7])) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1767 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1768 %!error roundb () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1769 %!error roundb (1, 2) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1770 */ |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1771 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1772 DEFUN (sign, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1773 "-*- texinfo -*-\n\ |
3321 | 1774 @deftypefn {Mapping Function} {} sign (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1775 Compute the @dfn{signum} function.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1776 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1777 This is defined as\n\ |
3321 | 1778 @tex\n\ |
1779 $$\n\ | |
1780 {\\rm sign} (@var{x}) = \\cases{1,&$x>0$;\\cr 0,&$x=0$;\\cr -1,&$x<0$.\\cr}\n\ | |
1781 $$\n\ | |
1782 @end tex\n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
1783 @ifnottex\n\ |
3321 | 1784 \n\ |
1785 @example\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
9041
diff
changeset
|
1786 @group\n\ |
3321 | 1787 -1, x < 0;\n\ |
1788 sign (x) = 0, x = 0;\n\ | |
1789 1, x > 0.\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
9041
diff
changeset
|
1790 @end group\n\ |
3321 | 1791 @end example\n\ |
10840 | 1792 \n\ |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8459
diff
changeset
|
1793 @end ifnottex\n\ |
3321 | 1794 \n\ |
1795 For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\ | |
15488
481417a57a2d
improve sign and signbit docs
John W. Eaton <jwe@octave.org>
parents:
15487
diff
changeset
|
1796 \n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1797 Note that @code{sign (-0.0)} is 0. Although IEEE 754 floating point\n\ |
15488
481417a57a2d
improve sign and signbit docs
John W. Eaton <jwe@octave.org>
parents:
15487
diff
changeset
|
1798 allows zero to be signed, 0.0 and -0.0 compare equal. If you must test\n\ |
481417a57a2d
improve sign and signbit docs
John W. Eaton <jwe@octave.org>
parents:
15487
diff
changeset
|
1799 whether zero is signed, use the @code{signbit} function.\n\ |
481417a57a2d
improve sign and signbit docs
John W. Eaton <jwe@octave.org>
parents:
15487
diff
changeset
|
1800 @seealso{signbit}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1801 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1802 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1803 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1804 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1805 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1806 return octave_value (args(0).signum ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1807 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1808 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1809 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1810 %!assert (sign (-2) , -1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1811 %!assert (sign (0), 0) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1812 %!assert (sign (3), 1) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1813 %!assert (sign ([1, -pi; e, 0]), [1, -1; 1, 0]) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1814 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1815 %!assert (sign (single (-2)) , single (-1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1816 %!assert (sign (single (0)), single (0)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1817 %!assert (sign (single (3)), single (1)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1818 %!assert (sign (single ([1, -pi; e, 0])), single ([1, -1; 1, 0])) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1819 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1820 %!error sign () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1821 %!error sign (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1822 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1823 |
15487
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1824 DEFUNX ("signbit", Fsignbit, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1825 "-*- texinfo -*-\n\ |
15487
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1826 @deftypefn {Mapping Function} {} signbit (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1827 Return logical true if the value of @var{x} has its sign bit set and false\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1828 otherwise.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1829 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1830 This behavior is consistent with the other logical functions.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1831 See @ref{Logical Values}. The behavior differs from the C language function\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1832 which returns nonzero if the sign bit is set.\n\ |
15487
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1833 \n\ |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1834 This is not the same as @code{x < 0.0}, because IEEE 754 floating point\n\ |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1835 allows zero to be signed. The comparison @code{-0.0 < 0.0} is false,\n\ |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1836 but @code{signbit (-0.0)} will return a nonzero value.\n\ |
15488
481417a57a2d
improve sign and signbit docs
John W. Eaton <jwe@octave.org>
parents:
15487
diff
changeset
|
1837 @seealso{sign}\n\ |
15487
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1838 @end deftypefn") |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1839 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1840 if (args.length () != 1) |
15487
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1841 print_usage (); |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1842 |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1843 octave_value tmp = args(0).xsignbit (); |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1844 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1845 return octave_value (tmp != 0); |
15487
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1846 } |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1847 |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1848 /* |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1849 %!assert (signbit (1) == 0) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1850 %!assert (signbit (-2) != 0) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1851 %!assert (signbit (0) == 0) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1852 %!assert (signbit (-0) != 0) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1853 |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1854 %!assert (signbit (single (1)) == 0) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1855 %!assert (signbit (single (-2)) != 0) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1856 %!assert (signbit (single (0)) == 0) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1857 %!assert (signbit (single (-0)) != 0) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1858 |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1859 %!error sign () |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1860 %!error sign (1, 2) |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1861 */ |
ecf5be238b4a
provide signbit mapper for real values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1862 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1863 DEFUN (sin, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1864 "-*- texinfo -*-\n\ |
3428 | 1865 @deftypefn {Mapping Function} {} sin (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
1866 Compute the sine for each element of @var{x} in radians.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
1867 @seealso{asin, sind, sinh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1868 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1869 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1870 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1871 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1872 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1873 return octave_value (args(0).sin ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1874 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1875 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1876 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1877 %!shared rt2, rt3 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1878 %! rt2 = sqrt (2); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1879 %! rt3 = sqrt (3); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1880 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1881 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1882 %! x = [0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1883 %! v = [0, 1/2, rt2/2, rt3/2, 1, rt3/2, rt2/2, 1/2, 0]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1884 %! assert (sin (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1885 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1886 %!test |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1887 %! x = single ([0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1888 %! v = single ([0, 1/2, rt2/2, rt3/2, 1, rt3/2, rt2/2, 1/2, 0]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1889 %! assert (sin (x), v, sqrt (eps ("single"))); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1890 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1891 %!error sin () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1892 %!error sin (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1893 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1894 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1895 DEFUN (sinh, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1896 "-*- texinfo -*-\n\ |
3428 | 1897 @deftypefn {Mapping Function} {} sinh (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
1898 Compute the hyperbolic sine for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
1899 @seealso{asinh, cosh, tanh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1900 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1901 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1902 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1903 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1904 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1905 return octave_value (args(0).sinh ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1906 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1907 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1908 /* |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1909 %!test |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1910 %! x = [0, pi/2*i, pi*i, 3*pi/2*i]; |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1911 %! v = [0, i, 0, -i]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1912 %! assert (sinh (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1913 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1914 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1915 %! x = single ([0, pi/2*i, pi*i, 3*pi/2*i]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1916 %! v = single ([0, i, 0, -i]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1917 %! assert (sinh (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1918 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1919 %!error sinh () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1920 %!error sinh (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
1921 */ |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1922 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1923 DEFUN (sqrt, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1924 "-*- texinfo -*-\n\ |
3321 | 1925 @deftypefn {Mapping Function} {} sqrt (@var{x})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1926 Compute the square root of each element of @var{x}.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1927 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1928 If @var{x} is negative, a complex result is returned.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1929 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
1930 To compute the matrix square root, see @ref{Linear Algebra}.\n\ |
11532
34bb8d38f19f
Add undocumented function cbrt to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11529
diff
changeset
|
1931 @seealso{realsqrt, nthroot}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1932 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1933 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1934 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1935 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1936 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1937 return octave_value (args(0).sqrt ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1938 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1939 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1940 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1941 %!assert (sqrt (4), 2) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1942 %!assert (sqrt (-1), i) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1943 %!assert (sqrt (1+i), exp (0.5 * log (1+i)), sqrt (eps)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1944 %!assert (sqrt ([4, -4; i, 1-i]), [2, 2i; exp(0.5 * log (i)), exp(0.5 * log (1-i))], sqrt (eps)) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1945 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1946 %!assert (sqrt (single (4)), single (2)) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1947 %!assert (sqrt (single (-1)), single (i)) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1948 %!assert (sqrt (single (1+i)), single (exp (0.5 * log (1+i))), sqrt (eps ("single"))) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1949 %!assert (sqrt (single ([4, -4; i, 1-i])), single ([2, 2i; exp(0.5 * log (i)), exp(0.5 * log (1-i))]), sqrt (eps ("single"))) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1950 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1951 %!error sqrt () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1952 %!error sqrt (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1953 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1954 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1955 DEFUN (tan, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1956 "-*- texinfo -*-\n\ |
3321 | 1957 @deftypefn {Mapping Function} {} tan (@var{z})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
1958 Compute the tangent for each element of @var{x} in radians.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
1959 @seealso{atan, tand, tanh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1960 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1961 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1962 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1963 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1964 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1965 return octave_value (args(0).tan ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1966 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1967 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1968 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1969 %!shared rt2, rt3 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1970 %! rt2 = sqrt (2); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1971 %! rt3 = sqrt (3); |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1972 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1973 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1974 %! x = [0, pi/6, pi/4, pi/3, 2*pi/3, 3*pi/4, 5*pi/6, pi]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1975 %! v = [0, rt3/3, 1, rt3, -rt3, -1, -rt3/3, 0]; |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1976 %! assert (tan (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1977 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1978 %!test |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1979 %! x = single ([0, pi/6, pi/4, pi/3, 2*pi/3, 3*pi/4, 5*pi/6, pi]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1980 %! v = single ([0, rt3/3, 1, rt3, -rt3, -1, -rt3/3, 0]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1981 %! assert (tan (x), v, sqrt (eps ("single"))); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1982 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1983 %!error tan () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
1984 %!error tan (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1985 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
1986 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1987 DEFUN (tanh, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1988 "-*- texinfo -*-\n\ |
3428 | 1989 @deftypefn {Mapping Function} {} tanh (@var{x})\n\ |
9155
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
1990 Compute hyperbolic tangent for each element of @var{x}.\n\ |
ad20b967e1c9
Update section 17.3 (Trigonometry) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
9154
diff
changeset
|
1991 @seealso{atanh, sinh, cosh}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1992 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1993 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1994 if (args.length () != 1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1995 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1996 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
1997 return octave_value (args(0).tanh ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
1998 } |
1562 | 1999 |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2000 /* |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2001 %!test |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2002 %! x = [0, pi*i]; |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2003 %! v = [0, 0]; |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2004 %! assert (tanh (x), v, sqrt (eps)); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2005 |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2006 %!test |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2007 %! x = single ([0, pi*i]); |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2008 %! v = single ([0, 0]); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2009 %! assert (tanh (x), v, sqrt (eps ("single"))); |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2010 |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2011 %!error tanh () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2012 %!error tanh (1, 2) |
7815
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2013 */ |
a41df65f3f00
Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents:
7814
diff
changeset
|
2014 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
2015 DEFUNX ("toascii", Ftoascii, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2016 "-*- texinfo -*-\n\ |
3361 | 2017 @deftypefn {Mapping Function} {} toascii (@var{s})\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2018 Return ASCII representation of @var{s} in a matrix.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2019 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2020 For example:\n\ |
3361 | 2021 \n\ |
2022 @example\n\ | |
2023 @group\n\ | |
2024 toascii (\"ASCII\")\n\ | |
2025 @result{} [ 65, 83, 67, 73, 73 ]\n\ | |
2026 @end group\n\ | |
2027 \n\ | |
2028 @end example\n\ | |
8442
502e58a0d44f
Fix docstrings, add examples, references and tests to string functions
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8387
diff
changeset
|
2029 @seealso{char}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2030 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2031 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2032 if (args.length () != 1) |
12892
67bf9b30f3f9
Error when given non-string input to tolower, toupper, toascii (Bug #33537).
Rik <octave@nomad.inbox5.com>
parents:
12683
diff
changeset
|
2033 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2034 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2035 return octave_value (args(0).xtoascii ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2036 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2037 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
2038 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2039 %!assert (toascii (char (0:127)), 0:127) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2040 %!assert (toascii (" ":"@"), 32:64) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2041 %!assert (toascii ("A":"Z"), 65:90) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2042 %!assert (toascii ("[":"`"), 91:96) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2043 %!assert (toascii ("a":"z"), 97:122) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2044 %!assert (toascii ("{":"~"), 123:126) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2045 |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2046 %!error toascii () |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2047 %!error toascii (1, 2) |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
2048 */ |
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
2049 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
2050 DEFUNX ("tolower", Ftolower, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2051 "-*- texinfo -*-\n\ |
10840 | 2052 @deftypefn {Mapping Function} {} tolower (@var{s})\n\ |
8387
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2053 @deftypefnx {Mapping Function} {} lower (@var{s})\n\ |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12636
diff
changeset
|
2054 Return a copy of the string or cell string @var{s}, with each uppercase\n\ |
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12636
diff
changeset
|
2055 character replaced by the corresponding lowercase one; non-alphabetic\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2056 characters are left unchanged.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2057 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2058 For example:\n\ |
3361 | 2059 \n\ |
2060 @example\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
9041
diff
changeset
|
2061 @group\n\ |
3361 | 2062 tolower (\"MiXeD cAsE 123\")\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
2063 @result{} \"mixed case 123\"\n\ |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
9041
diff
changeset
|
2064 @end group\n\ |
3361 | 2065 @end example\n\ |
8442
502e58a0d44f
Fix docstrings, add examples, references and tests to string functions
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8387
diff
changeset
|
2066 @seealso{toupper}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2067 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2068 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2069 if (args.length () != 1) |
12892
67bf9b30f3f9
Error when given non-string input to tolower, toupper, toascii (Bug #33537).
Rik <octave@nomad.inbox5.com>
parents:
12683
diff
changeset
|
2070 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2071 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2072 return octave_value (args(0).xtolower ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2073 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2074 |
8387
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2075 DEFALIAS (lower, tolower); |
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2076 |
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2077 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2078 %!assert (tolower ("OCTAVE"), "octave") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2079 %!assert (tolower ("123OCTave!_&"), "123octave!_&") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2080 %!assert (tolower ({"ABC", "DEF", {"GHI", {"JKL"}}}), {"abc", "def", {"ghi", {"jkl"}}}) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2081 %!assert (tolower (["ABC"; "DEF"]), ["abc"; "def"]) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2082 %!assert (tolower ({["ABC"; "DEF"]}), {["abc";"def"]}) |
18196
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2083 %!assert (tolower (68), 68) |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2084 %!assert (tolower ({[68, 68; 68, 68]}), {[68, 68; 68, 68]}) |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2085 %!test |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2086 %! classes = {@char, @double, @single, ... |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2087 %! @int8, @int16, @int32, @int64, ... |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2088 %! @uint8, @uint16, @uint32, @uint64}; |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2089 %! for i = 1:numel (classes) |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2090 %! cls = classes{i}; |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2091 %! assert (class (tolower (cls (97))), class (cls (97))); |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2092 %! assert (class (tolower (cls ([98, 99]))), class (cls ([98, 99]))); |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2093 %! endfor |
8387
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2094 %!test |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2095 %! a(3,3,3,3) = "D"; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2096 %! assert (tolower (a)(3,3,3,3), "d"); |
8387
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2097 |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
2098 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
2099 %! charset = char (0:127); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
2100 %! result = charset; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2101 %! result (toascii ("A":"Z") + 1) = result (toascii ("a":"z") + 1); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2102 %! assert (tolower (charset), result); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2103 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2104 %!error <Invalid call to tolower> lower () |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2105 %!error <Invalid call to tolower> tolower () |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2106 %!error tolower (1, 2) |
8387
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2107 */ |
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2108 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
2109 DEFUNX ("toupper", Ftoupper, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2110 "-*- texinfo -*-\n\ |
12683
486c9aea34d3
doc: Correctly refer to toupper() as a Mapping Function.
Rik <octave@nomad.inbox5.com>
parents:
12660
diff
changeset
|
2111 @deftypefn {Mapping Function} {} toupper (@var{s})\n\ |
486c9aea34d3
doc: Correctly refer to toupper() as a Mapping Function.
Rik <octave@nomad.inbox5.com>
parents:
12660
diff
changeset
|
2112 @deftypefnx {Mapping Function} {} upper (@var{s})\n\ |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12636
diff
changeset
|
2113 Return a copy of the string or cell string @var{s}, with each lowercase\n\ |
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12636
diff
changeset
|
2114 character replaced by the corresponding uppercase one; non-alphabetic\n\ |
20172
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2115 characters are left unchanged.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2116 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19730
diff
changeset
|
2117 For example:\n\ |
3361 | 2118 \n\ |
2119 @example\n\ | |
2120 @group\n\ | |
3552 | 2121 toupper (\"MiXeD cAsE 123\")\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
2122 @result{} \"MIXED CASE 123\"\n\ |
3361 | 2123 @end group\n\ |
2124 @end example\n\ | |
8442
502e58a0d44f
Fix docstrings, add examples, references and tests to string functions
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8387
diff
changeset
|
2125 @seealso{tolower}\n\ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2126 @end deftypefn") |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2127 { |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2128 if (args.length () != 1) |
12892
67bf9b30f3f9
Error when given non-string input to tolower, toupper, toascii (Bug #33537).
Rik <octave@nomad.inbox5.com>
parents:
12683
diff
changeset
|
2129 print_usage (); |
20805
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2130 |
2d6ddb2b157c
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20183
diff
changeset
|
2131 return octave_value (args(0).xtoupper ()); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2132 } |
3321 | 2133 |
8387
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2134 DEFALIAS (upper, toupper); |
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2135 |
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2136 /* |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2137 %!assert (toupper ("octave"), "OCTAVE") |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2138 %!assert (toupper ("123OCTave!_&"), "123OCTAVE!_&") |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2139 %!assert (toupper ({"abc", "def", {"ghi", {"jkl"}}}), {"ABC", "DEF", {"GHI", {"JKL"}}}) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2140 %!assert (toupper (["abc"; "def"]), ["ABC"; "DEF"]) |
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2141 %!assert (toupper ({["abc"; "def"]}), {["ABC";"DEF"]}) |
18196
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2142 %!assert (toupper (100), 100) |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2143 %!assert (toupper ({[100, 100; 100, 100]}), {[100, 100; 100, 100]}) |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2144 %!test |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2145 %! classes = {@char, @double, @single, ... |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2146 %! @int8, @int16, @int32, @int64, ... |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2147 %! @uint8, @uint16, @uint32, @uint64}; |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2148 %! for i = 1:numel (classes) |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2149 %! cls = classes{i}; |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2150 %! assert (class (toupper (cls (97))), class (cls (97))); |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2151 %! assert (class (toupper (cls ([98, 99]))), class (cls ([98, 99]))); |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
2152 %! endfor |
8387
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2153 %!test |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2154 %! a(3,3,3,3) = "d"; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2155 %! assert (toupper (a)(3,3,3,3), "D"); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
2156 %!test |
13964
12fa52c6e886
Use char() instead of deprecated setstr() in %!test code.
Rik <octave@nomad.inbox5.com>
parents:
13929
diff
changeset
|
2157 %! charset = char (0:127); |
13140
98d23b0f16e1
maint: move test_string.m tests to source files
John W. Eaton <jwe@octave.org>
parents:
13093
diff
changeset
|
2158 %! result = charset; |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2159 %! result (toascii ("a":"z") + 1) = result (toascii ("A":"Z") + 1); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2160 %! assert (toupper (charset), result); |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2161 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2162 %!error <Invalid call to toupper> toupper () |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
2163 %!error <Invalid call to toupper> upper () |
13972
09432c6f23e7
mappers.cc: Update %!tests to modern coding standards
Rik <octave@nomad.inbox5.com>
parents:
13966
diff
changeset
|
2164 %!error toupper (1, 2) |
8387
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2165 */ |
1567db1e166c
make upper and lower aliases of toupper and tolower respectively
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8366
diff
changeset
|
2166 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2167 DEFALIAS (gammaln, lgamma); |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7385
diff
changeset
|
2168 |