Mercurial > hg > octave-nkf
annotate scripts/deprecated/strerror.m @ 12749:e7cc2d4a6db3 stable
Fix range of sigma in normal distribution to exclude 0.
* normcdf.m, normpdf.m: Correct 's >= 0' to 's > 0'.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Thu, 16 Jun 2011 21:05:10 -0700 |
parents | 89604fa96d2f |
children | 72c96de7a403 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 1995-2011 John W. Eaton |
2313 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
2313 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
1576 | 18 |
3381 | 19 ## -*- texinfo -*- |
3373 | 20 ## @deftypefn {Function File} {} strerror (@var{name}, @var{num}) |
21 ## Return the text of an error message for function @var{name} | |
22 ## corresponding to the error number @var{num}. This function is intended | |
23 ## to be used to print useful error messages for those functions that | |
24 ## return numeric error codes. | |
25 ## @end deftypefn | |
1576 | 26 |
2314 | 27 ## Author: jwe |
28 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
29 function msg = strerror (name, num) |
1576 | 30 |
12574
89604fa96d2f
Deprecate perror, strerror functions.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
31 persistent warned = false; |
89604fa96d2f
Deprecate perror, strerror functions.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
32 if (! warned) |
89604fa96d2f
Deprecate perror, strerror functions.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
33 warned = true; |
89604fa96d2f
Deprecate perror, strerror functions.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
34 warning ("Octave:deprecated-function", |
89604fa96d2f
Deprecate perror, strerror functions.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
35 "strerror is obsolete and will be removed from a future version of Octave."); |
89604fa96d2f
Deprecate perror, strerror functions.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
36 endif |
89604fa96d2f
Deprecate perror, strerror functions.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
37 |
1576 | 38 if (nargin != 2) |
6046 | 39 print_usage (); |
1576 | 40 endif |
41 | |
5443 | 42 if (! ischar (name)) |
1576 | 43 error ("strerror: first argument must be a string"); |
44 endif | |
45 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
46 if (! isscalar (num)) |
1576 | 47 error ("strerror: second argument must be a scalar"); |
48 endif | |
49 | |
50 if (strcmp (name, "fsolve")) | |
51 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
52 if (num == -2) |
1576 | 53 msg = "input error\n"; |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
54 elseif (num == -1) |
1576 | 55 msg = "error encountered in user-supplied function\n"; |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
56 elseif (num == 1) |
1576 | 57 msg = "solution converged to requested tolerance\n"; |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
58 elseif (num == 3) |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
59 msg = "iteration is not making good progress\n"; |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
60 elseif (num == 4) |
1576 | 61 msg = "iteration limit exceeded\n"; |
62 else | |
63 error ("strerror: unrecognized error code for fsolve"); | |
64 endif | |
65 | |
66 else | |
67 | |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
11469
diff
changeset
|
68 error ("strerror: unrecognized function NAME"); |
1576 | 69 |
70 endif | |
71 | |
72 endfunction |