Mercurial > octave
diff libinterp/corefcn/pr-output.cc @ 20946:6eff66fb8a02
style fixes for comments
* find-dialog.cc, find-dialog.h, display.cc, error.cc, gl-render.cc,
graphics.cc, graphics.in.h, max.cc, oct-handle.h, oct-obj.h,
oct-stream.cc, oct.h, pr-output.cc, profiler.cc, str2double.cc,
symtab.cc, toplev.cc, toplev.h, xgl2ps.c, zfstream.cc, zfstream.h,
__glpk__.cc, audiodevinfo.cc, colamd.cc, symbfact.cc, ov-classdef.cc,
ov-classdef.h, ov-java.cc, op-int.h, pt-pr-code.cc, pt-walk.h:
Use C++-style comments where possible.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 18 Dec 2015 22:39:36 -0500 |
parents | a4f5da7c5463 |
children | 258c787cd9ce |
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc Fri Dec 18 22:06:22 2015 -0500 +++ b/libinterp/corefcn/pr-output.cc Fri Dec 18 22:39:36 2015 -0500 @@ -218,18 +218,21 @@ return x; else return x - 3*static_cast<int> (x/3); - /* The expression above is equivalent to x - (x % 3). - * According to the ISO specification for C++ the modulo operator is - * compiler dependent if any of the arguments are negative. Since this - * function will need to work on negative arguments, and we want to avoid - * portability issues, we re-implement the modulo function to the desired - * behavior (truncation). There may be a gnulib replacement. - * - * ISO/IEC 14882:2003 : Programming languages -- C++. 5.6.4: ISO, IEC. 2003 . - * "the binary % operator yields the remainder from the division of the first - * expression by the second. .... If both operands are nonnegative then the - * remainder is nonnegative; if not, the sign of the remainder is - * implementation-defined". */ + + // The expression above is equivalent to x - (x % 3). + + // According to the ISO specification for C++ the modulo operator is + // compiler dependent if any of the arguments are negative. Since + // this function will need to work on negative arguments, and we want + // to avoid portability issues, we re-implement the modulo function to + // the desired behavior (truncation). There may be a gnulib + // replacement. + + // ISO/IEC 14882:2003 : Programming languages -- C++. 5.6.4: ISO, + // IEC. 2003 . "the binary % operator yields the remainder from the + // division of the first expression by the second. .... If both + // operands are nonnegative then the remainder is nonnegative; if not, + // the sign of the remainder is implementation-defined". } static int @@ -240,8 +243,8 @@ { double absval = (x < 0.0 ? -x : x); int logabsval = static_cast<int> (gnulib::floor (log10 (absval))); - /* Avoid using modulo function with negative arguments for portability. - * See extended comment at calc_scale_exp */ + // Avoid using modulo function with negative arguments for + // portability. See extended comment at calc_scale_exp if (logabsval < 0.0) ex = logabsval - 2 + ((-logabsval + 2) % 3); else