Ticket #7377: trac_7377-floatcast.patch

File trac_7377-floatcast.patch, 926 bytes (added by nbruin, 8 years ago)

make max_to_sr return RealDoubleElement? rather than float

  • sage/interfaces/maxima_lib.py

    # HG changeset patch
    # User Nils Bruin <nbruin@sfu.ca>
    # Date 1299014848 28800
    # Node ID 56afff4b15b4660e2332d9b06be2bf747d82f7dc
    # Parent  13499b4b5d702c424194898f739c2a230f5a641e
    make max_to_sr return RealDoubleElement rather than float
    
    diff -r 13499b4b5d70 -r 56afff4b15b4 sage/interfaces/maxima_lib.py
    a b  
    725725            return maxima(expr).ecl()
    726726   
    727727# This goes from EclObject to SR
     728import sage.rings.real_double
     729
    728730def max_to_sr(expr):
    729731    if expr.consp():
    730732        op_max=caar(expr)
     
    746748            max_sym_dict[expr]=sage_symbol
    747749        return max_sym_dict[expr]
    748750    else:
    749         return expr.python()
     751        e=expr.python()
     752        if isinstance(e,float):
     753            return sage.rings.real_double.RealDoubleElement(e)
     754        return e
    750755