Index: /issm/trunk-jpl/src/c/shared/Numerics/extrema.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/extrema.cpp	(revision 23243)
+++ /issm/trunk-jpl/src/c/shared/Numerics/extrema.cpp	(revision 23244)
@@ -11,16 +11,20 @@
 #include "./types.h"
 
+#ifndef _HAVE_CODIPACK_// already defined in codipack headers
 IssmDouble min(IssmDouble a,IssmDouble b){
 	if (a<b)return a;
 	else return b;
 }
+#endif
 int min(int a,int b){
 	if (a<b)return a;
 	else return b;
 }
+#ifndef _HAVE_CODIPACK_// already defined in codipack headers
 IssmDouble max(IssmDouble a,IssmDouble b){
 	if (a>b)return a;
 	else return b;
 }
+#endif
 int max(int a,int b){
 	if (a>b)return a;
@@ -28,5 +32,5 @@
 }
 
-#ifdef _HAVE_ADOLC_
+#ifdef _HAVE_AD_
 IssmPDouble  min(IssmPDouble a,IssmPDouble b){
 	if (a<b)return a;
Index: /issm/trunk-jpl/src/c/shared/Numerics/isnan.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/isnan.cpp	(revision 23243)
+++ /issm/trunk-jpl/src/c/shared/Numerics/isnan.cpp	(revision 23244)
@@ -13,9 +13,15 @@
   return std::isnan(X.getValue());
 }
-#endif
-
-#if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)
 template <> int xIsInf<adouble> (const adouble& X){
   return std::isinf(X.getValue());
 }
 #endif
+
+#if defined(_HAVE_CODIPACK_) && !defined(_WRAPPERS_)
+template <> int xIsNan<IssmDouble> (const IssmDouble& X){
+	  return std::isnan(X.getValue());
+}
+template <> int xIsInf<IssmDouble> (const IssmDouble& X){
+	return std::isinf(X.getValue());
+}
+#endif
Index: /issm/trunk-jpl/src/c/shared/Numerics/isnan.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/isnan.h	(revision 23243)
+++ /issm/trunk-jpl/src/c/shared/Numerics/isnan.h	(revision 23244)
@@ -33,3 +33,9 @@
 #endif
 
+#if defined(_HAVE_CODIPACK_) && !defined(_WRAPPERS_)
+#include "./types.h"
+template <> int xIsNan<IssmDouble> (const IssmDouble& X);
+template <> int xIsInf<IssmDouble> (const IssmDouble& X);
 #endif
+
+#endif
Index: /issm/trunk-jpl/src/c/shared/Numerics/numerics.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 23243)
+++ /issm/trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 23244)
@@ -20,8 +20,11 @@
 #include "./OptPars.h"
 
+#if !defined(_HAVE_CODIPACK_)
+// already defined in codipack headers
 IssmDouble  min(IssmDouble a,IssmDouble b);
 IssmDouble  max(IssmDouble a,IssmDouble b);
+#endif
 
-#ifdef _HAVE_ADOLC_
+#ifdef _HAVE_AD_
 IssmPDouble  min(IssmPDouble a,IssmPDouble b);
 IssmPDouble  max(IssmPDouble a,IssmPDouble b);
Index: /issm/trunk-jpl/src/c/shared/Numerics/recast.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/recast.h	(revision 23243)
+++ /issm/trunk-jpl/src/c/shared/Numerics/recast.h	(revision 23244)
@@ -15,5 +15,5 @@
 #endif
 
-#if !defined(_HAVE_ADOLC_) || defined(_WRAPPERS_)
+#if !defined(_HAVE_AD_) || defined(_WRAPPERS_)
 
 template<class To, class From> To reCast(const From& from) {
@@ -34,7 +34,14 @@
  * partial specialization
  */
+#ifdef _HAVE_ADOLC_
 template<class To> struct ForPartialSpecialization<To,adouble> {
     static  To reCast(const adouble& from ) { return (To) (from.getValue());}
 };
+#endif
+#ifdef _HAVE_CODIPACK_
+template<class To> struct ForPartialSpecialization<To,IssmDouble> {
+	    static  To reCast(const IssmDouble& from ) { return (To) (from.getValue());}
+};
+#endif
 
 #endif
Index: /issm/trunk-jpl/src/c/shared/Numerics/types.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/types.h	(revision 23243)
+++ /issm/trunk-jpl/src/c/shared/Numerics/types.h	(revision 23244)
@@ -22,13 +22,18 @@
 
 #if defined(_HAVE_ADOLC_) &&  !defined(_WRAPPERS_)
+/*ADOLC typedefs*/
 #include "adolc/adolc.h"
-// for active variables
-typedef adouble IssmDouble;
-// for passive variables
+typedef adouble IssmDouble; /*for active variables*/
+typedef double IssmPDouble; /*for passive variables*/
+
+#elif defined(_HAVE_CODIPACK_) && !defined(_WRAPPERS_)
+/*CoDiPack typedefs*/
+#include <codi.hpp>
+typedef codi::RealReverse IssmDouble;
 typedef double IssmPDouble;
+
+/*Non-AD typedefs*/
 #else 
-// see above
 typedef double IssmDouble; 
-// see above
 typedef IssmDouble IssmPDouble;
 #endif
