Thank you, Samuel. The conversion to RDF worked because it coerces the 
other types to RDF (I think). If I convert the multiplier values to RR, RLF 
or float, the conversion does not help anymore.

On Monday, October 6, 2014 1:30:03 PM UTC-3, slelievre wrote:
>
>
> João Alberto Ferreira wrote:
>>
>> I am plotting some graphs, but the plot becomes cluttered because of 
>> the long labels. The labels are result of a conversion from a Real 
>> number to a string. The problem here is that Sage is not consistent 
>> with Python, as shown in the example below. 
>>
>> Python: 
>> >>> multiplier = [1.0e0, 1.0e1, 1.0e2] 
>> >>> multiplier 
>> [1.0, 10.0, 100.0] 
>> >>> str(multiplier[-1]) 
>> '100.0' 
>>
>>
>> Sage: 
>> sage: multiplier = [1.0e0, 1.0e1, 1.0e2] 
>> sage: multiplier 
>> [1.00000000000000, 10.0000000000000, 100.000000000000] 
>> sage: str(multiplier[-1]) 
>> '100.000000000000' 
>>
>> Is this a correct behavior of Sage? at least for me, the excess of 
>> trailing zeros is causing some trouble. 
>>
>
> One option is to work with RDF:
>
> sage: multiplier = [1.0e0, 1.0e1, 1.0e2]
> sage: multiplier = [RDF(x) for x in multiplier]
> sage: multiplier
> [1.0, 10.0, 100.0]
> sage: str(multiplier[-1])
> '100.0'
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to