# 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 -r c08e9d4e54c7 -r 6ead75935ebf doc/ChangeLog --- a/doc/ChangeLog Tue Nov 02 19:15:19 2010 -0400 +++ b/doc/ChangeLog Mon Aug 30 13:49:07 2010 -0500 @@ -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 -r c08e9d4e54c7 -r 6ead75935ebf doc/interpreter/numbers.txi --- a/doc/interpreter/numbers.txi Tue Nov 02 19:15:19 2010 -0400 +++ b/doc/interpreter/numbers.txi Mon Aug 30 13:49:07 2010 -0500 @@ -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