Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think, the problem occurs as in the following case:

sage: a = RIF( pi^3 ) sage: a 31.0062766802999? sage: floor(a), type(floor(a)) (31, <type 'sage.rings.real_mpfi.realintervalfieldelement'="">) sage: ceil(a), type(ceil(a)) (32, <type 'sage.rings.real_mpfi.realintervalfieldelement'="">)

and the two methods work, but still do not leave the encapsulation, so no real number is provided. If this is the problem, then note that the "interval instance" a has a lower and an upper method, which leave the class, offer real numbers, where we can apply as desired floor and ceil, then possibly coerce. For instance:

sage: a = RIF( pi^3 )
sage: a
31.0062766802999?

sage: a.lower(), type( a.lower() )
(31.0062766802998, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: floor( a.lower() ), type( floor( a.lower() ) )
(31, <type 'sage.rings.integer.Integer'>)
sage: floor( a.lower() ) . is_prime()
True

sage: a.upper(), type( a.upper() )
(31.0062766802999, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: ceil( a.upper() ), type( ceil( a.upper() ) )
(32, <type 'sage.rings.integer.Integer'>)
sage: ceil( a.upper() ) . is_prime_power()
True

I think, the problem occurs as in the following case:

sage: a = RIF( pi^3 )
sage: a
31.0062766802999?
sage: floor(a), type(floor(a))
(31, <type 'sage.rings.real_mpfi.realintervalfieldelement'="">)
'sage.rings.real_mpfi.RealIntervalFieldElement'>)
sage: ceil(a), type(ceil(a))
(32, <type 'sage.rings.real_mpfi.realintervalfieldelement'="">)

'sage.rings.real_mpfi.RealIntervalFieldElement'>)

and the two methods work, but still do not leave the encapsulation, so no real number is provided. If this is the problem, then note that the "interval instance" a has a lower and an upper method, which leave the class, offer real numbers, where we can apply as desired floor and ceil, then possibly coerce. For instance:

sage: a = RIF( pi^3 )
sage: a
31.0062766802999?

sage: a.lower(), type( a.lower() )
(31.0062766802998, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: floor( a.lower() ), type( floor( a.lower() ) )
(31, <type 'sage.rings.integer.Integer'>)
sage: floor( a.lower() ) . is_prime()
True

sage: a.upper(), type( a.upper() )
(31.0062766802999, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: ceil( a.upper() ), type( ceil( a.upper() ) )
(32, <type 'sage.rings.integer.Integer'>)
sage: ceil( a.upper() ) . is_prime_power()
True

I think, the problem occurs as in the following case:

sage: a = RIF( pi^3 )
sage: a
31.0062766802999?
sage: floor(a), type(floor(a))
(31, <type 'sage.rings.real_mpfi.RealIntervalFieldElement'>)
sage: ceil(a), type(ceil(a))
(32, <type 'sage.rings.real_mpfi.RealIntervalFieldElement'>)

and the two methods work, but still do not leave the encapsulation, so no real number is provided. If this is the problem, then note that the "interval instance" a has a lower and an upper method, which leave the class, offer real numbers, where we can apply as desired floor and ceil, then possibly coerce. ... For instance:

sage: a = RIF( pi^3 )
sage: a
31.0062766802999?

sage: a.lower(), type( a.lower() )
(31.0062766802998, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: floor( a.lower() ), type( floor( a.lower() ) )
(31, <type 'sage.rings.integer.Integer'>)
sage: floor( a.lower() ) . is_prime()
True

sage: a.upper(), type( a.upper() )
(31.0062766802999, <type 'sage.rings.real_mpfr.RealNumber'>)
sage: ceil( a.upper() ), type( ceil( a.upper() ) )
(32, <type 'sage.rings.integer.Integer'>)
sage: ceil( a.upper() ) . is_prime_power()
True