Index: trunk/Ohana/src/opihi/lib.data/spline.c
===================================================================
--- trunk/Ohana/src/opihi/lib.data/spline.c	(revision 42821)
+++ trunk/Ohana/src/opihi/lib.data/spline.c	(revision 42967)
@@ -1,3 +1,18 @@
 # include "data.h"
+
+static SplineMode MODE = SPLINE_SATURATE; // SATURATE or EXTRAPOLATE?
+
+int spline_contruct_mode (SplineMode mode) {
+  
+  switch (mode) {
+  case SPLINE_SATURATE:
+  case SPLINE_EXTRAPOLATE:
+    MODE = mode;
+    break;
+  default:
+    return FALSE;
+  }
+  return TRUE;
+}
 
 /* construct the natural spline for x, y in y2 */
@@ -36,6 +51,8 @@
   
   // saturate correction at high and low ends
-  if (X < x[0]) return y[0];
-  if (X > x[N-1]) return y[N-1];
+  if (MODE == SPLINE_SATURATE) {
+    if (X < x[0]) return y[0];
+    if (X > x[N-1]) return y[N-1];
+  }
 
   /* find correct element in array (x must be sorted) */
@@ -113,18 +130,8 @@
   opihi_flt dx, a, b, value;
   
-  // linear extrapolation past endpoints
-  if (X < x[0]) {
-    hi = 1;
-    lo = 0;
-    goto evaluate;
-    // alternative: saturate correction at high and low ends
-    // return y[0]; 
-  }
-  if (X > x[N-1]) {
-    hi = N - 1;
-    lo = N - 2;
-    goto evaluate;
-    // alternative: saturate correction at high and low ends
-    // return y[N-1];
+  // saturate correction at high and low ends
+  if (MODE == SPLINE_SATURATE) {
+    if (X < x[0]) return y[0];
+    if (X > x[N-1]) return y[N-1];
   }
 
@@ -140,6 +147,4 @@
     }
   }
-
-evaluate:
 
   /* error condition: duplicate abssisca */
