root / pobysoPythonSage / src / sageGMP.spyx @ 198
Historique | Voir | Annoter | Télécharger (835 octet)
1 |
#cimport cython |
---|---|
2 |
from libc.stdlib cimport malloc,free |
3 |
from sage.rings.rational cimport * |
4 |
# |
5 |
# Sage file in the cimport closes are in <sage_dir>/src/sage directory. |
6 |
# |
7 |
# |
8 |
# Functions to manipulate the real Rational values. |
9 |
# |
10 |
# Import constants and declarations that are not exported |
11 |
# from the Sage real_mpfr.pyx file. |
12 |
# Notes: |
13 |
# - notice how #define constants are imported. |
14 |
# - before mpfr_min_prec() is declared, we need to "ctypedef" mpfr_prec_t |
15 |
# if we want to be consistent with MPFR notations. The actual type comes |
16 |
# from mpfr.h but, according to documentation, any type of same general |
17 |
# kind would have been OK. |
18 |
|
19 |
cpdef inline unsigned long int sgmp_get_rational_value(Rational x): |
20 |
""" |
21 |
Get the address of the value of a Rational. |
22 |
""" |
23 |
return(<unsigned long int>(&(x.value))) |
24 |
# End sgmp_get_rational. |