changeset 5054:d112fc15399c

[project @ 2004-10-21 06:30:38 by jwe]
author jwe
date Thu, 21 Oct 2004 06:30:39 +0000
parents c08cb1098afc
children 51a4406317e9
files src/ChangeLog src/ov-base.cc
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Oct 19 23:10:55 2004 +0000
+++ b/src/ChangeLog	Thu Oct 21 06:30:39 2004 +0000
@@ -1,3 +1,7 @@
+2004-10-21  John W. Eaton  <jwe@octave.org>
+
+	* ov-base.cc (INT_CONV_METHOD): Apply saturation semantics here too.
+
 2004-10-19  John W. Eaton  <jwe@octave.org>
 
 	* ov-range.h (octave_range::write): New function.
--- a/src/ov-base.cc	Tue Oct 19 23:10:55 2004 +0000
+++ b/src/ov-base.cc	Thu Oct 21 06:30:39 2004 +0000
@@ -264,9 +264,10 @@
       { \
 	if (require_int && D_NINT (d) != d) \
 	  error ("conversion of %g to " #T " value failed", d); \
-	else if (d < MIN_LIMIT || d > MAX_LIMIT) \
-	  error ("conversion of %g to short int out of range (%d, %d)", \
-		 d, MIN_LIMIT, MAX_LIMIT); \
+	else if (d < MIN_LIMIT) \
+	  retval = MIN_LIMIT; \
+	else if (d > MAX_LIMIT) \
+	  retval = MAX_LIMIT; \
 	else \
 	  retval = static_cast<T> (fix (d)); \
       } \