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

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

Re: Tutorial question re conventions or usage ??


From: Eli Zaretskii
Subject: Re: Tutorial question re conventions or usage ??
Date: Tue, 01 May 2007 22:31:56 +0300

> From: William Case <address@hidden>
> Date: Tue, 01 May 2007 13:44:18 -0400
> 
> (if (> (buffer-size) 10000)
>            ;; Avoid overflow for large buffer sizes!
>            (* (prefix-numeric-value arg)
>               (/ (buffer-size) 10))
>          (/ (+ 10 (* (buffer-size)
>                      (prefix-numeric-value arg)))
> ...
> 
> In this code the writer has reduced the numbers by a factor of 10 in
> order, it seems, to get the user to supply a one digit prefix that
> none-the-less ends up being a percentage.  

I think it's more likely that the author wanted to avoid
floating-point arithmetics, and also avoid overflow (as the comment
says).  Interpreting the argument as percentage would require
multiplication by 100, which would exacerbate the integer overflow
problem.

Just a guess.




reply via email to

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