#cimport cython 
from libc.stdlib          cimport malloc,free
from sage.rings.rational cimport *
#
# Sage file in the cimport closes are in <sage_dir>/src/sage directory.
#
#
# Functions to manipulate the real Rational values.
#
# Import constants and declarations that are not exported
# from the Sage real_mpfr.pyx file.
# Notes:
# - notice how #define constants are imported.
# - 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.

cpdef inline unsigned long int sgmp_get_rational_value(Rational x):
    """
    Get the address of the value of a Rational.
    """
    return(<unsigned long int>(&(x.value)))
# End sgmp_get_rational.