On Sun, Dec 28, 2008 at 12:29 PM, agi <[email protected]> wrote:
>
> Hi,
> I have a number like 12.345 and I would like to count the digits.
> There's a function 123.digits(10) which returns
> a vector whose length counts the digits. But this only works for
> integers and I need it for real numbers.
Is this the sort of thing you want?
sage: n = 123.45
sage: n
123.450000000000
sage: len(str(n).rstrip('0')) - 1
5
> >
>
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
--~--~---------~--~----~------------~-------~--~----~
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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---