diff liboctave/lo-utils.cc @ 5275:23b37da9fd5b

[project @ 2005-04-08 16:07:35 by jwe]
author jwe
date Fri, 08 Apr 2005 16:07:37 +0000
parents 743ef6154f8a
children 4c8a2e4e0717
line wrap: on
line diff
--- a/liboctave/lo-utils.cc
+++ b/liboctave/lo-utils.cc
@@ -46,6 +46,20 @@
 // Convert X to the nearest integer value.  Should not pass NaN to
 // this function.
 
+// Sometimes you need a large integer, but not always.
+// XXX FIXME-64 XXX -- INT_MAX and INT_MIN are probably not right here.
+
+octave_idx_type
+NINTbig (double x)
+{
+  if (x > INT_MAX)
+    return INT_MAX;
+  else if (x < INT_MIN)
+    return INT_MIN;
+  else
+    return static_cast<octave_idx_type> ((x > 0) ? (x + 0.5) : (x - 0.5));
+}
+
 int
 NINT (double x)
 {