Index: pobysoPythonSage/src/testSageMpfr.sage
===================================================================
--- pobysoPythonSage/src/testSageMpfr.sage	(revision 0)
+++ pobysoPythonSage/src/testSageMpfr.sage	(revision 160)
@@ -0,0 +1,29 @@
+"""
+@file testSageMpfr.sage
+Test module for pobyso.py functions.
+
+AUTHORS:
+- S.T. (2015-05-04): initial version
+
+TODO:
+- almost everything!
+
+"""
+print "\ntestSageMpfr loading..."
+attach(str('/home/storres/recherche/arithmetique/pobysoPythonSage/src/ppsTestFunctions.sage'))
+#
+
+def test_get_interval_value(repeat=10, number=100):
+    functionName =  inspect.stack()[0][3]
+    print "Running", inspect.stack()[0][3], "..."
+    intervalSa = RIF(1,2)
+    #
+    def test(intervalSa):
+        intervalSaValue = get_interval_value(intervalSa)
+    #
+    wrapped = pps_test_wrapper(test,intervalSa)
+    timing = min(timeit.repeat(wrapped, repeat=repeat, number=number))        
+    print "\t...", functionName, "done."
+    return timing
+
+print "\t...testSageMpfr loaded"
Index: pobysoPythonSage/src/sageMpfr.spyx
===================================================================
--- pobysoPythonSage/src/sageMpfr.spyx	(revision 159)
+++ pobysoPythonSage/src/sageMpfr.spyx	(revision 160)
@@ -1,5 +1,5 @@
 #cimport cython 
-from libc.stdlib cimport malloc,free
+from libc.stdlib          cimport malloc,free
 from sage.rings.real_mpfr cimport *
 from sage.rings.real_mpfi cimport *
 #
@@ -9,11 +9,14 @@
 # from the Sage real_mpfr.pyx file.
 # Notes:
 # - notice how #define constants are imported.
-# - mpfr_min_prec() is declared with an unsigned int return value, not
-#   a mpfr_prec_t since it is not recognized as type in Cython.
+# - before mpfr_min_prec() is declared, we need to "ctypedef" mpfr_prec_t
+#   if we want to be consistent with MPFR notations. The actual type comes 
+#   from mpfr.h but, according to documentation, any type of same general 
+#   kind would have been OK.
 cdef extern from "mpfr.h":
-    cdef int MPFR_PREC_MIN "MPFR_PREC_MIN"
-    cdef unsigned int mpfr_min_prec(mpfr_t x)
+    ctypedef unsigned short mpfr_prec_t
+    cdef mpfr_prec_t MPFR_PREC_MIN "MPFR_PREC_MIN"
+    cdef mpfr_prec_t mpfr_min_prec(mpfr_t x)
 
 cpdef int get_interval_value(RealIntervalFieldElement x):
     """
@@ -44,42 +47,56 @@
     """
     # We use the "array trick" to workaround the pointer dereferencing
     # issue (in Cython there is no unary operator "*").
-    #
     mpfr_set(x.value, (<mpfr_t *>p)[0], rnd)
 #
-cpdef min_rn_size(RealNumber x):
+cpdef mpfr_prec_t min_rn_size(RealNumber x):
     """
     Compute the minimum number of bits necessary to represent
-    the x RealNumber's value.
+    the x Sage RealNumber's value.
     If x is a power of 2 (only 1 bit needed) return the MPFR
     MPFR_PREC_MIN value.
     """
-    cdef int min_prec = mpfr_min_prec(x.value) 
+    cdef mpfr_prec_t min_prec = mpfr_min_prec(x.value) 
     if min_prec < MPFR_PREC_MIN:
         return(MPFR_PREC_MIN)
     else:
         return(min_prec)
-
+#
 cpdef min_mpfr_size(int p):
     """
     Compute the minimum number of bits necessary to represent
-    the MPFR value pointed by p.
-    If x is a power of 2 (only 1 bit needed) return the MPFR
+    the MPFR value pointed by the mpfr_t pointer p (hence the int type).
+    If *p is a power of 2 (only 1 bit needed) return the MPFR
     MPFR_PREC_MIN value.
     """
-    cdef int min_prec = mpfr_min_prec((<mpfr_t *>p)[0]) 
+    # We use the "array trick" to workaround the pointer dereferencing
+    # issue (in Cython there is no unary operator "*").
+    cdef mpfr_prec_t min_prec = mpfr_min_prec((<mpfr_t *>p)[0]) 
     if min_prec < MPFR_PREC_MIN:
         return(MPFR_PREC_MIN)
     else:
         return(min_prec)
 
 cpdef free_mpfi_num(int mpfiNum):
+    """
+    Free a MPFI interval pointed by mpfiNum (hece the int type).
+    """
+    # We use the "array trick" to workaround the pointer dereferencing
+    # issue (in Cython there is no unary operator "*").
     mpfi_clear((<mpfi_t*>mpfiNum)[0])
 
 cpdef free_mpfr_num(int mpfrNum):
+    """
+    Free a MPFR number pointed by mpfrNum (hece the int type).
+    """
+    # We use the "array trick" to workaround the pointer dereferencing
+    # issue (in Cython there is no unary operator "*").
     mpfr_clear((<mpfr_t*>mpfrNum)[0])
 
-cpdef new_interval_num(unsigned int prec):
+cpdef int new_interval_num(unsigned int prec):
+    """
+    Create a newly allocated MPFI interval to precision prec.
+    """
     cdef mpfi_t *newValue = NULL
     print "Precision : ", prec
     newValue = <mpfi_t*>malloc(sizeof(mpfi_t))
@@ -87,7 +104,7 @@
     print "Creation done!"
     return(<int>newValue)
 
-cpdef new_mpfr_num(unsigned int prec):
+cpdef int new_mpfr_num(unsigned int prec):
     cdef mpfr_t *newValue = NULL
     print "Precision : ", prec
     newValue = <mpfr_t*>malloc(sizeof(mpfr_t))
@@ -103,6 +120,13 @@
     """
     return(mpfr_cmp(x.value, y.value))
  
+cpdef cmp_interval_value(RealIntervalFieldElement x, 
+                         RealIntervalFieldElement y):
+    """
+    Compare two intervals with the mpfi_cmp function
+    """
+    return(mpfi_cmp(x.value, y.value))
+ 
 # Do not use this function!
 # It changes the precision of the instance behind the curtain, but precision is
 # class attribute. If the precision is increased, memory space is wasted and
Index: pobysoPythonSage/src/ppsTestFunctions.sage
===================================================================
--- pobysoPythonSage/src/ppsTestFunctions.sage	(revision 0)
+++ pobysoPythonSage/src/ppsTestFunctions.sage	(revision 160)
@@ -0,0 +1,34 @@
+"""
+@file ppsTestFunctions.sage
+
+Module for functions used in all sorts of tests.
+
+AUTHORS:
+- S.T. (2015-05-03): initial version
+
+TODO:
+- almost everything!
+
+"""
+print "ppsTestFunctions loading..."
+import inspect
+import resource
+import timeit
+
+
+def pps_memory_usage():
+    rusage_denom = RR("1024")
+    if sys.platform == 'darwin':
+        # ... it seems that in OSX the output is different units ...
+        rusage_denom = rusage_denom * rusage_denom
+    mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / rusage_denom
+    return mem
+# End memory_usage_resource()
+
+def pps_test_wrapper(func, *args, **kwargs):
+    def wrapped():
+        return func(*args, **kwargs)
+    return wrapped
+
+print "\t...ppsTestFunctions loaded"
+
Index: pobysoPythonSage/src/testPobyso.sage
===================================================================
--- pobysoPythonSage/src/testPobyso.sage	(revision 159)
+++ pobysoPythonSage/src/testPobyso.sage	(revision 160)
@@ -5,7 +5,7 @@
 - S.T. (2014-02-26): initial version
 
 TODO:
-- everything!
+- almost everything!
 
 """
 
@@ -20,7 +20,7 @@
     rusage_denom = RR("1024")
     if sys.platform == 'darwin':
         # ... it seems that in OSX the output is different units ...
-        rusage_denom = rusage_denom * rusage_denom
+        rusage_denom = rusage_denom^2
     mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / rusage_denom
     return mem
 # End memory_usage_resource()
