annotate scripts/miscellaneous/single.m @ 6971:0a9d97cf2e13

[project @ 2007-10-07 19:44:53 by dbateman]
author dbateman
date Sun, 07 Oct 2007 19:44:53 +0000
parents 687ae48b2253
children 93c65f2a5668
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5476
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 2005 John W. Eaton
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
2 ##
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
4 ##
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 2, or (at your option)
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
8 ## any later version.
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
9 ##
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
14 ##
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
18 ## 02110-1301, USA.
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
19
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
20 ## -*- texinfo -*-
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefn {Function File} {} single (@var{val})
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
22 ## Convert the numeric value @var{val} to single precision.
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
23 ##
6615
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6046
diff changeset
24 ## @strong{Note}: this function currently returns its argument converted
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6046
diff changeset
25 ## to double precision because Octave does not yet have a single-precision
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6046
diff changeset
26 ## numeric data type.
5476
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
27 ## @end deftypefn
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
28
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
29 function retval = single (val)
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
30
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
31 if (nargin == 1 && isnumeric (val))
6615
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6046
diff changeset
32 retval = double(val);
5476
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
33 else
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 5476
diff changeset
34 print_usage ();
5476
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
35 endif
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
36
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents:
diff changeset
37 endfunction