On Jan 15, 2009, at 4:25 PM, [email protected] wrote:

> OK, I'm confused about the time procedure.  What's the difference  
> between
> sage: time s =  2^3021377-1
> CPU time: 0.00 s,  Wall time: 0.00 s

The variable s now holds the integer 2^3021377-1, represented  
internally in binary.

> and
> sage: time k = str(s)
> CPU time: 0.67 s,  Wall time: 0.67 s

k now holds the string (decimal) representation of s, as a python  
string object (essentially a char* under the hood). This is much  
harder to compute (the internal format is not decimal), and took  
nearly a second on his machine.

If I were to write

sage: 2^3021377-1

it would first compute the value, then turn it into a string for  
printing. The above separates the two steps. Hope that helps clarify  
things.

- Robert


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-edu?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to