Here is a better definition:

def float(x,e,b):
    return RealField(axiom('precision()$Float'))(x)*b^e

On Sat, Sep 6, 2008 at 11:10 PM, Bill Page wrote:
> On Sat, Sep 6, 2008 at 10:49 PM, Bill Page wrote:
>> On Sat, Sep 6, 2008 at 10:32 PM, Mike Hansen wrote:
>>>
>>> I still find the following behavior much worse than the current
>>> behavior (which is why I made the change):
>>>
>>> sage: axiom(2.123)
>>> float(156649750673941527080,-66,2)
>>>
>>> That's not useful to anyone or any other system.
>>>
>>
>> By default Axiom uses arbitrary precision floats. This function call
>> is an attempt to retain all of the available precision in the internal
>> representation. Perhaps this could be implemented in Sage as a mpfr
>> function call?
>>
>
> Does this function definition help?
>
> sage: def float(x,e,b):
>    return 0.0+x*b^e
> ....:
> sage: eval(repr(axiom('2.123')))
> 2.12300000000000
>
> The 0.0 + ... hack just forces coercion to mpfr. Probably there's a better 
> way.
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to