help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting an Integer into Human Readable String


From: Eli Zaretskii
Subject: Re: Converting an Integer into Human Readable String
Date: Fri, 08 Apr 2011 11:29:11 +0300

> From: Thierry Volpiatto <address@hidden>
> Date: Fri, 08 Apr 2011 09:07:45 +0200
> 
> Note that all functions that use elisp to get such result fail with:
> 
> --8<---------------cut here---------------start------------->8---
> (url-pretty-length 7141892608)
> Debugger entered--Lisp error: (overflow-error "7141892608")
> --8<---------------cut here---------------end--------------->8---
> 
> When using big numbers.

That's because you assume that the size is an integer.  But the doc
string of file-attributes says:

 7. Size in bytes.
  This is a floating point number if the size is too large for an integer.

So this is not a problem when used with file sizes.  Other uses will
have to take care to use a floating point number for large values.

> Same for format-mode-line etc...

format-mode-line (and the mode line itself) can only display the size
of an Emacs buffer, which can never be larger than the maximum value
of an Emacs Lisp integer on the same platform.  So this isn't a
problem, either.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]