Index: pobysoPythonSage/src/sageMpfr.spyx
===================================================================
--- pobysoPythonSage/src/sageMpfr.spyx	(revision 161)
+++ pobysoPythonSage/src/sageMpfr.spyx	(revision 162)
@@ -19,6 +19,9 @@
     cdef mp_rnd_t MPFR_RNDN "MPFR_RNDN"
     cdef mpfr_prec_t mpfr_min_prec(mpfr_t x)
 
+cpdef unsigned long int deref(unsigned long int p, int index):
+    return((<unsigned long int*>p)[index])
+
 cpdef unsigned long int get_interval_value(RealIntervalFieldElement x):
     """
     Get the address of the value of a RealIntervalField Element. 
@@ -115,19 +118,19 @@
 
 #
 
-cpdef cmp_rn_value(RealNumber x, RealNumber y):
-    """
-    Compare two RN with the mpfr_cmp function
-    """
-    return(mpfr_cmp(x.value, y.value))
- 
-cpdef cmp_interval_value(RealIntervalFieldElement x, 
+cpdef cmp_interval_values(RealIntervalFieldElement x, 
                          RealIntervalFieldElement y):
     """
     Compare two intervals with the mpfi_cmp function
     """
     return(mpfi_cmp(x.value, y.value))
  
+cpdef cmp_rn_values(RealNumber x, RealNumber y):
+    """
+    Compare two RN with the mpfr_cmp function
+    """
+    return(mpfr_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/sollya_lib.sage
===================================================================
--- pobysoPythonSage/src/sollya_lib.sage	(revision 161)
+++ pobysoPythonSage/src/sollya_lib.sage	(revision 162)
@@ -78,6 +78,9 @@
         sollya_lib_on = sollya.sollya_lib_on
         sollya_lib_parse_string = sollya.sollya_lib_parse_string
         sollya_lib_range = sollya.sollya_lib_range
+        sollya_lib_range_from_bounds = sollya.sollya_lib_range_from_bounds
+        sollya_lib_range_from_interval = \
+            sollya.sollya_lib_range_from_interval
         sollya_lib_relative = sollya.sollya_lib_relative
         sollya_lib_remez = sollya.sollya_lib_remez
         sollya_lib_set_canonical = sollya.sollya_lib_set_canonical
@@ -104,9 +107,14 @@
 # Set the argument type of several functions.
 #
 try:
+    sollya_lib_autoprint.argtypes            = [c_ulong]
+    sollya_lib_constant.argtypes             = [c_ulong]
+    sollya_lib_constant.restype              = c_ulong
+    sollya_lib_get_constant.argtypes         = [c_ulong, c_ulong]
     sollya_lib_get_constant_as_int.argtypes  = [POINTER(c_int), c_int]
     sollya_lib_get_function_arity.argtypes   = [POINTER(c_int), c_int]
     sollya_lib_get_head_function.argtypes    = [POINTER(c_int), c_int]
+    sollya_lib_get_interval_from_range.argtypes = [c_ulong, c_ulong]
     sollya_lib_get_list_elements.argtypes    = [POINTER(POINTER(c_longlong)), \
                                                 POINTER(c_int),\
                                                 POINTER(c_int), c_int]
@@ -116,7 +124,17 @@
             POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int), \
             POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int), \
             POINTER(c_int), POINTER(c_int)]
+    sollya_lib_guessdegree.argtypes          = [c_ulong, c_ulong, c_ulong, \
+            c_ulong, c_ulong]
+    sollya_lib_guessdegree.restype           = c_ulong        
     sollya_lib_name_free_variable.argtypes   = [POINTER(c_char)]
+    sollya_lib_parse_string.restype          = c_long
+    sollya_lib_range.argtypes                = [c_ulong, c_ulong]
+    sollya_lib_range.restype                 = c_ulong
+    sollya_lib_range_from_bounds.argtypes    = [c_ulong, c_ulong]
+    sollya_lib_range_from_bounds.restype     = c_ulong
+    sollya_lib_range_from_interval.argtypes  = [c_ulong]
+    sollya_lib_range_from_interval.restype   = c_ulong
 except :
     print "\nOne of the Python-Sollya argument type setting command has \
           failed.\n"
Index: pobysoPythonSage/src/testPobyso.sage
===================================================================
--- pobysoPythonSage/src/testPobyso.sage	(revision 161)
+++ pobysoPythonSage/src/testPobyso.sage	(revision 162)
@@ -76,19 +76,24 @@
     pointSo    = pobyso_constant_sa_so(RR("1.5"))
     intervalSo = pobyso_interval_to_range_sa_so(intervalSa)
     #
-    def test(lowerBoundSa, upperBoundSa):
+    def test(functionSo, degreeSo, pointSo, intervalSo):
         taylorformSo = pobyso_taylorform_so_so(functionSo,
                                                degreeSo,
                                                pointSo,
                                                intervalSo)
-        sollya_lib_clear_obj(rangeSo)
+        pobyso_clear_taylorform_sa_so(taylorformSo)
     #
-    wrapped = test_pobyso_wrapper(test,lowerBoundSa, upperBoundSa)
+    wrapped = test_pobyso_wrapper(test,
+                                  functionSo, 
+                                  degreeSo, 
+                                  pointSo, 
+                                  intervalSo)
     timing = min(timeit.repeat(wrapped, repeat=repeat, number=number))
     #
-    precSo = pobyso_get_prec_so()
-    #pobyso_autoprint(precSo)
-    sollya_lib_clear_obj(precSo)
+    sollya_lib_clear_obj(functionSo)
+    sollya_lib_clear_obj(degreeSo)
+    sollya_lib_clear_obj(pointSo)
+    sollya_lib_clear_obj(intervalSo)
     print "\t...", functionName, "done."
     return timing
 # End test_pobyso_bounds_to_range_sa_so
Index: pobysoPythonSage/src/pobyso.py
===================================================================
--- pobysoPythonSage/src/pobyso.py	(revision 161)
+++ pobysoPythonSage/src/pobyso.py	(revision 162)
@@ -99,7 +99,7 @@
     """
     Return a Sollya range from to 2 RealField Sage elements.
     The Sollya range element has a sufficient precision to hold all
-    the digits of the Sage bounds.
+    the digits of the widest of the Sage bounds.
     """
     # Sanity check.
     if rnLowerBoundSa > rnUpperBoundSa:
@@ -113,10 +113,13 @@
     else:
         maxPrecSa = precisionSa
     # From Sage to Sollya bounds.
-    lowerBoundSo = sollya_lib_constant(get_rn_value(rnLowerBoundSa),
+#    lowerBoundSo = sollya_lib_constant(get_rn_value(rnLowerBoundSa),
+#                                       maxPrecSa)
+    lowerBoundSo = pobyso_constant_sa_so(rnLowerBoundSa,
+                                         maxPrecSa)
+    upperBoundSo = pobyso_constant_sa_so(rnUpperBoundSa,
                                        maxPrecSa)
-    upperBoundSo = sollya_lib_constant(get_rn_value(rnUpperBoundSa),
-                                       maxPrecSa)
+    
     # From Sollya bounds to range.
     rangeSo = sollya_lib_range(lowerBoundSo, upperBoundSo)
     # Back to original precision.
@@ -798,10 +801,10 @@
     else:
         degreeBoundSo = None
     guessedDegreeSa = pobyso_guess_degree_so_sa(functionSo,
-                                              rangeSo,
-                                              approxErrorSo,
-                                              weightSo,
-                                              degreeBoundSo)
+                                                rangeSo,
+                                                approxErrorSo,
+                                                weightSo,
+                                                degreeBoundSo)
     sollya_lib_clear_obj(functionSo)
     sollya_lib_clear_obj(rangeSo)
     sollya_lib_clear_obj(approxErrorSo)
@@ -831,15 +834,19 @@
     if neededPrecisionSa > currentPrecSa:
         currentPrecSo = pobyso_get_prec_so()
         pobyso_set_prec_sa_so(neededPrecisionSa)
+    print "Guessing degree..."
     # weightSo and degreeBoundsSo are optional arguments.
+    # As declared, sollya_lib_guessdegree must take 5 arguments.
     if weightSo is None:
-        degreeRangeSo = sollya_lib_guessdegree(functionSo, rangeSo, errorSo, None)
+        degreeRangeSo = sollya_lib_guessdegree(functionSo, rangeSo, errorSo, 
+                                               0, 0, None)
     elif degreeBoundSo is None:
         degreeRangeSo =  sollya_lib_guessdegree(functionSo, rangeSo, \
-                                                errorSo, weightSo, None)
+                                                errorSo, weightSo, 0, None)
     else:
         degreeRangeSo =  sollya_lib_guessdegree(functionSo, rangeSo, errorSo, \
                                                 weightSo, degreeBoundSo, None)
+    print "Degree guess done."
     # Restore internal precision, if applicable.
     if neededPrecisionSa > currentPrecSa:
         pobyso_set_prec_so_so(currentPrecSo)
@@ -1117,96 +1124,98 @@
     return resultSo
 # End pobyso_supnorm_so_so
 
-def pobyso_taylor_expansion_with_change_var_so_so(functionSo, degreeSo, \
-                                                  rangeSo, \
-                                                  errorTypeSo=None, \
-                                                  sollyaPrecSo=None):
+def pobyso_taylor_expansion_no_change_var_so_so(functionSo, 
+                                                degreeSo, 
+                                                rangeSo,
+                                                errorTypeSo=None, 
+                                                sollyaPrecSo=None):
     """
-    Compute the Taylor expansion with the variable change
-    x -> (x-intervalCenter) included.
+    Compute the Taylor expansion without the variable change
+    x -> x-intervalCenter.
     """
     # No global change of the working precision.
     if not sollyaPrecSo is None:
         initialPrecSo = sollya_lib_get_prec(None)
         sollya_lib_set_prec(sollyaPrecSo)
-    #
     # Error type stuff: default to absolute.
     if errorTypeSo is None:
         errorTypeIsNone = True
         errorTypeSo = sollya_lib_absolute(None)
     else:
         errorTypeIsNone = False
-    intervalCenterSo = sollya_lib_mid(rangeSo)
-    taylorFormSo = sollya_lib_taylorform(functionSo, degreeSo, \
-                                         intervalCenterSo, \
+    intervalCenterSo = sollya_lib_mid(rangeSo, None)
+    taylorFormSo = sollya_lib_taylorform(functionSo, degreeSo,
+                                         intervalCenterSo,
                                          rangeSo, errorTypeSo, None)
     # taylorFormListSaSo is a Python list of Sollya objects references that 
     # are copies of the elements of taylorFormSo.
     # pobyso_get_list_elements_so_so clears taylorFormSo.
-    (taylorFormListSo, numElements, isEndElliptic) = \
+    (taylorFormListSaSo, numElementsSa, isEndEllipticSa) = \
         pobyso_get_list_elements_so_so(taylorFormSo)
-    polySo = taylorFormListSo[0]
-    errorRangeSo = taylorFormListSo[2]
+    polySo = sollya_lib_copy_obj(taylorFormListSaSo[0])
+    #print "Num elements:", numElementsSa
+    sollya_lib_clear_obj(taylorFormSo)
+    #polySo = taylorFormListSaSo[0]
+    #errorRangeSo = sollya_lib_copy_obj(taylorFormListSaSo[2])
+    errorRangeSo = taylorFormListSaSo[2]
+    # No copy_obj needed here: a new object is created.
     maxErrorSo = sollya_lib_sup(errorRangeSo)
-    changeVarExpSo = sollya_lib_build_function_sub(\
-                       sollya_lib_build_function_free_variable(),\
-                       sollya_lib_copy_obj(intervalCenterSo))
-    polyVarChangedSo = sollya_lib_evaluate(polySo, changeVarExpSo) 
-    sollya_lib_clear_obj(changeVarExpSo)
     # If changed, reset the Sollya working precision.
     if not sollyaPrecSo is None:
         sollya_lib_set_prec(initialPrecSo)
         sollya_lib_clear_obj(initialPrecSo)
     if errorTypeIsNone:
         sollya_lib_clear_obj(errorTypeSo)
-    sollya_lib_clear_obj(taylorFormSo)
-    # Do not clear maxErrorSo.
-    return((polyVarChangedSo, intervalCenterSo, maxErrorSo))
-# end pobyso_taylor_expansion_with_change_var_so_so
+    pobyso_clear_taylorform_sa_so(taylorFormListSaSo)
+    return((polySo, intervalCenterSo, maxErrorSo))
+# end pobyso_taylor_expansion_no_change_var_so_so
 
-def pobyso_taylor_expansion_no_change_var_so_so(functionSo, degreeSo, rangeSo,
-                                                errorTypeSo=None, 
-                                                sollyaPrecSo=None):
+def pobyso_taylor_expansion_with_change_var_so_so(functionSo, degreeSo, \
+                                                  rangeSo, \
+                                                  errorTypeSo=None, \
+                                                  sollyaPrecSo=None):
     """
-    Compute the Taylor expansion without the variable change
-    x -> x-intervalCenter.
+    Compute the Taylor expansion with the variable change
+    x -> (x-intervalCenter) included.
     """
     # No global change of the working precision.
     if not sollyaPrecSo is None:
         initialPrecSo = sollya_lib_get_prec(None)
         sollya_lib_set_prec(sollyaPrecSo)
+    #
     # Error type stuff: default to absolute.
     if errorTypeSo is None:
         errorTypeIsNone = True
         errorTypeSo = sollya_lib_absolute(None)
     else:
         errorTypeIsNone = False
-    intervalCenterSo = sollya_lib_mid(rangeSo, None)
-    taylorFormSo = sollya_lib_taylorform(functionSo, degreeSo,
-                                         intervalCenterSo,
+    intervalCenterSo = sollya_lib_mid(rangeSo)
+    taylorFormSo = sollya_lib_taylorform(functionSo, degreeSo, \
+                                         intervalCenterSo, \
                                          rangeSo, errorTypeSo, None)
     # taylorFormListSaSo is a Python list of Sollya objects references that 
     # are copies of the elements of taylorFormSo.
     # pobyso_get_list_elements_so_so clears taylorFormSo.
-    (taylorFormListSaSo, numElementsSa, isEndEllipticSa) = \
+    (taylorFormListSo, numElements, isEndElliptic) = \
         pobyso_get_list_elements_so_so(taylorFormSo)
-    polySo = sollya_lib_copy_obj(taylorFormListSaSo[0])
-    #print "Num elements:", numElementsSa
-    sollya_lib_clear_obj(taylorFormSo)
-    #polySo = taylorFormListSaSo[0]
-    #errorRangeSo = sollya_lib_copy_obj(taylorFormListSaSo[2])
-    errorRangeSo = taylorFormListSaSo[2]
-    # No copy_obj needed here: a new object is created.
+    polySo = taylorFormListSo[0]
+    errorRangeSo = taylorFormListSo[2]
     maxErrorSo = sollya_lib_sup(errorRangeSo)
+    changeVarExpSo = sollya_lib_build_function_sub(\
+                       sollya_lib_build_function_free_variable(),\
+                       sollya_lib_copy_obj(intervalCenterSo))
+    polyVarChangedSo = sollya_lib_evaluate(polySo, changeVarExpSo) 
+    sollya_lib_clear_obj(changeVarExpSo)
     # If changed, reset the Sollya working precision.
     if not sollyaPrecSo is None:
         sollya_lib_set_prec(initialPrecSo)
         sollya_lib_clear_obj(initialPrecSo)
     if errorTypeIsNone:
         sollya_lib_clear_obj(errorTypeSo)
-    pobyso_clear_taylorform_sa_so(taylorFormListSaSo)
-    return((polySo, intervalCenterSo, maxErrorSo))
-# end pobyso_taylor_expansion_no_change_var_so_so
+    sollya_lib_clear_obj(taylorFormSo)
+    # Do not clear maxErrorSo.
+    return((polyVarChangedSo, intervalCenterSo, maxErrorSo))
+# end pobyso_taylor_expansion_with_change_var_so_so
 
 def pobyso_taylor(function, degree, point):
     """ Legacy function. See pobysoTaylor_so_so. """
Index: pobysoPythonSage/src/testSageMpfr.sage
===================================================================
--- pobysoPythonSage/src/testSageMpfr.sage	(revision 161)
+++ pobysoPythonSage/src/testSageMpfr.sage	(revision 162)
@@ -10,20 +10,70 @@
 
 """
 print "\ntestSageMpfr loading..."
+load(str('/home/storres/recherche/arithmetique/pobysoPythonSage/src/ppsTestFunctions.sage'))
+#
+
+def test_cmp_rn_values(repeat=10, number=100):
+    functionName =  inspect.stack()[0][3]
+    print "Running", inspect.stack()[0][3], "..."
+    rn1Sa    = RR(1)
+    rn1bisSa = RR(1) 
+    rn2Sa    = RR(2)
+    #
+    def test(rn1Sa, rn1bisSa, rn2Sa):
+        if cmp_rn_values(rn1Sa, rn1bisSa) != 0:
+            exit()
+        if cmp_rn_values(rn1Sa, rn2Sa) >= 0:
+            exit()
+        if cmp_rn_values(rn2Sa, rn1Sa) <= 0:
+            exit()
+    wrapped = pps_test_wrapper(test, rn1Sa, rn1bisSa, rn2Sa)
+    timing = min(timeit.repeat(wrapped, repeat=repeat, number=number))        
+    print "\t...", functionName, "done."
+    return timing
+# End test_cmp_rn_values
+
+def test_get_set_interval_value(repeat=10, number=100):
+    functionName =  inspect.stack()[0][3]
+    print "Running", inspect.stack()[0][3], "..."
+    interval1Sa = RIF(1,2)
+    interval2Sa = RIF(2,3)
+    #
+    def test(interval1Sa, interval2Sa):
+        interval1SaValue = get_interval_value(interval1Sa)
+        interval2SaValue = get_interval_value(interval2Sa)
+        set_interval_value(interval2Sa, interval1SaValue)
+        if cmp_interval_values(interval1Sa, interval2Sa) != 0:
+            exit()
+        set_interval_value(interval2Sa, interval2SaValue)
+    #
+    wrapped = pps_test_wrapper(test, interval1Sa, interval2Sa)
+    timing = min(timeit.repeat(wrapped, repeat=repeat, number=number))        
+    print "\t...", functionName, "done."
+    return timing
+# End test_get_set_interval_value
+
+print "\ntestSageMpfr loading..."
 attach(str('/home/storres/recherche/arithmetique/pobysoPythonSage/src/ppsTestFunctions.sage'))
 #
 
-def test_get_interval_value(repeat=10, number=100):
+def test_get_set_rn_value(repeat=10, number=100):
     functionName =  inspect.stack()[0][3]
     print "Running", inspect.stack()[0][3], "..."
-    intervalSa = RIF(1,2)
+    rn1Sa = RR(1)
+    rn2Sa = RR(2)
     #
-    def test(intervalSa):
-        intervalSaValue = get_interval_value(intervalSa)
+    def test(rn1Sa, rn2Sa):
+        rn1SaValue = get_rn_value(rn1Sa)
+        rn2SaValue = get_rn_value(rn2Sa)
+        set_rn_value(rn2Sa, rn1SaValue)
+        if cmp_rn_values(rn1Sa, rn2Sa) != 0:
+            exit()
+        set_rn_value(rn2Sa, rn2SaValue)
     #
-    wrapped = pps_test_wrapper(test,intervalSa)
+    wrapped = pps_test_wrapper(test, rn1Sa, rn2Sa)
     timing = min(timeit.repeat(wrapped, repeat=repeat, number=number))        
     print "\t...", functionName, "done."
     return timing
-
+# End test_get_set_rn_value
 print "\t...testSageMpfr loaded"
