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

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

Are integer operations really integral?


From: Norbert Grün
Subject: Are integer operations really integral?
Date: Mon, 09 Jan 2006 20:57:37 +0100

Dear Madam or Sir!

I recently used Emacs 20.7 for WinNT to check the date of the initial 
issue
of our longtime weekly pulp Sci-Fi novel Perry Rhodan
(www.Perry-Rhodan.net).

I fired up the calendar, positioned to 2006-01-06 for volume 2316 and 
said

C-u 2316 C-p

to go back this many weeks.

I landed on 1961-08-18 whereas the mag part told of 1961-09-08 which is
three weeks later.

I sent already a mail to the publishers whether they had issued two 
volumes
a week for a couple of times when changing publishing day which had
happened a few times in the past.

The error is 0.13% which may or may not pile up in floating point
calculations when iterated that many times.

But a C-u <num> <command> repetition is integral in its very nature 
and the
ELISP engine should be much happier with integers for decrementing the 
loop
over the <command> than fiddling with floats and doubles.

ALGOL60 allowed REALs as loop and ARRAY indices, PASCAL stopped this 
abuse.
C(++) may allow it, but it is highly disrecommended because a loop
termination condition testing for equality against an integral value 
like
zero is almost guaranteed to fail resulting in an endless loop. Also
testing for inequality will result in haphazard one-off errors hard to
debug. Also integers should be large enough to avoid a rollover as I
realised once on a VAX.

So please check whether your integer arithmetic is not secretly 
converted
to float in a dark corner of your code albeit this should be ironed out
long ago regarding the major version (20.7).

Kind Regards

Norbert Grün (gnor-spam@x-mail.net)





--

Stop wasting everybody else's ressources!
------------------------------------------------------------------------------------
Free X-Mail.net, Voice Calls (VoIP) and Messages, Messenger, 
http://www.x-mail.net
SnoopBlocker Anonymous SSL Secure Web Surfing, http://www.snoopblocker.com
Search Teradex Web Site Directory http://www.teradex.com







reply via email to

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