Mercurial > octave
diff liboctave/util/oct-inttypes.h @ 21574:ae4d7dfea337
maint: merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 01 Apr 2016 12:57:49 -0400 |
parents | 06d15e4e611a f3f8e1d3e399 |
children | aba2e6293dd8 |
line wrap: on
line diff
--- a/liboctave/util/oct-inttypes.h Thu Mar 31 14:12:13 2016 -0700 +++ b/liboctave/util/oct-inttypes.h Fri Apr 01 12:57:49 2016 -0400 @@ -317,34 +317,11 @@ } public: + // Convert a real number (check NaN and non-int). template <typename S> static T - convert_real (const S& value) - { - // Compute proper thresholds. - static const S thmin = compute_threshold (static_cast<S> (min_val ()), - min_val ()); - static const S thmax = compute_threshold (static_cast<S> (max_val ()), - max_val ()); - if (xisnan (value)) - { - return static_cast<T> (0); - } - else if (value < thmin) - { - return min_val (); - } - else if (value > thmax) - { - return max_val (); - } - else - { - S rvalue = xround (value); - return static_cast<T> (rvalue); - } - } + convert_real (const S& value); }; // Saturated (homogeneous) integer arithmetics. The signed and unsigned