Mercurial > hg > octave-lyh
changeset 11179:6ead75935ebf
Explain that ranges in vectors do get expanded
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 13:49:07 -0500 |
parents | c08e9d4e54c7 |
children | 1a26199cb212 |
files | doc/ChangeLog doc/interpreter/numbers.txi |
diffstat | 2 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2010-11-01 Jordi GutiƩrrez Hermoso <jordigh@gmail.com> + + * interpreter/numbers.txi: Explain that ranges in vectors do get + expanded. + 2010-10-24 Rik <octave@nomad.inbox5.com> * interpreter/doccheck/mk_undocumented_list: New verification
--- a/doc/interpreter/numbers.txi +++ b/doc/interpreter/numbers.txi @@ -393,6 +393,24 @@ This allows you to write a constant like @samp{1 : 10000} without using 80,000 bytes of storage on a typical 32-bit workstation. +A common example of when it does become necessary to convert ranges into +vectors occurs when they appear within a vector (i.e. inside square +brackets). For instance, whereas + +@example +x = 0 : 0.1 : 1; +@end example + +defines @var{x} to be a variable of type @code{range} and occupies 24 +bytes of memory, the expression + +@example +y = [ 0 : 0.1 : 1]; +@end example + +defines @var{y} to be of type @code{matrix} and occupies 88 bytes of +memory. + Note that the upper (or lower, if the increment is negative) bound on the range is not always included in the set of values, and that ranges defined by floating point values can produce surprising results because