changeset 25286:44c0aca121cc stable

doc: Clarify docstring for sum (bug #53698). * data.cc: Provide a better explanation of "native" argument and what happens when it is not present.
author Rik <rik@octave.org>
date Thu, 19 Apr 2018 08:39:45 -0700
parents 78fb24bdd8bb
children f692728de113
files libinterp/corefcn/data.cc
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/data.cc	Thu Apr 19 01:58:44 2018 -0400
+++ b/libinterp/corefcn/data.cc	Thu Apr 19 08:39:45 2018 -0700
@@ -2858,9 +2858,11 @@
 If @var{dim} is omitted, it defaults to the first non-singleton dimension.
 
 The optional @qcode{"type"} input determines the class of the variable
-used for calculations.  If the argument @qcode{"native"} is given, then
-the operation is performed in the same type as the original argument, rather
-than the default double type.
+used for calculations.  By default, operations on floating point inputs (double
+or single) are performed in their native data type, while operations on
+integer, logical, and character data types are performed using doubles.  If the
+argument @qcode{"native"} is given, then the operation is performed in the same
+type as the original argument.
 
 For example:
 
@@ -2873,13 +2875,13 @@
 @end group
 @end example
 
-On the contrary, if @qcode{"double"} is given, the sum is performed in
-double precision even for single precision inputs.
+If @qcode{"double"} is given the sum is performed in double precision even for
+single precision inputs.
 
 For double precision inputs, the @qcode{"extra"} option will use a more
 accurate algorithm than straightforward summation.  For single precision
-inputs, @qcode{"extra"} is the same as @qcode{"double"}.  Otherwise,
-@qcode{"extra"} has no effect.
+inputs, @qcode{"extra"} is the same as @qcode{"double"}.  For all other data
+type @qcode{"extra"} has no effect.
 @seealso{cumsum, sumsq, prod}
 @end deftypefn */)
 {