# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1283194147 18000 # Node ID 6ead75935ebf0234fb145c3e7d3cdeb978323916 # Parent c08e9d4e54c7732d6b693d3188d20f86fc10c51c Explain that ranges in vectors do get expanded diff --git a/doc/ChangeLog b/doc/ChangeLog --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2010-11-01 Jordi GutiƩrrez Hermoso + + * interpreter/numbers.txi: Explain that ranges in vectors do get + expanded. + 2010-10-24 Rik * interpreter/doccheck/mk_undocumented_list: New verification diff --git a/doc/interpreter/numbers.txi b/doc/interpreter/numbers.txi --- 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