unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Are integer operations really integral?
@ 2006-01-09 19:57 Norbert Grün
  0 siblings, 0 replies; only message in thread
From: Norbert Grün @ 2006-01-09 19:57 UTC (permalink / raw


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-09 19:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-09 19:57 Are integer operations really integral? Norbert Grün

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).