Mercurial > hg > octave-terminal
changeset 11664:7fde54a3e0ce release-3-0-x
oct-rand.cc: fix typo
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 Feb 2008 20:30:46 -0500 |
parents | 3f5a67e8215c |
children | 31443b3c5d3b |
files | liboctave/ChangeLog liboctave/oct-rand.cc |
diffstat | 2 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,9 @@ 2008-02-26 John W. Eaton <jwe@octave.org> + * oct-rand.cc (get_dist_id): Fix typo. + (get_dist_id, octave_rand::distribution, octave_rand::scalar, + fill_rand): Improve error messages. + * oct-rand.cc (unknown_dist): New dist type. (uniform_dist, normal_dist, expon_dist, poisson_dist, gamma_dist): Use static const int instead of #define.
--- a/liboctave/oct-rand.cc +++ b/liboctave/oct-rand.cc @@ -197,10 +197,11 @@ retval = expon_dist; else if (d == "poisson" || d == "randp") retval = poisson_dist; - else if (d == "gamma" || d == "rangd") + else if (d == "gamma" || d == "randg") retval = gamma_dist; else - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution `%s'", d.c_str ()); return retval; } @@ -349,7 +350,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", current_distribution); break; } @@ -359,7 +361,9 @@ void octave_rand::distribution (const std::string& d) { - switch (get_dist_id (d)) + int id = get_dist_id (d); + + switch (id) { case uniform_dist: octave_rand::uniform_distribution (); @@ -382,7 +386,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", id); break; } } @@ -480,7 +485,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", current_distribution); break; } } @@ -509,7 +515,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", current_distribution); break; } @@ -613,7 +620,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", current_distribution); break; }