From: dennison@telepath.com
Subject: Re: Simple Real_Time.Time_Span question
Date: 1998/10/15
Date: 1998-10-15T00:00:00+00:00 [thread overview]
Message-ID: <705g81$g9s$1@nnrp1.dejanews.com> (raw)
In-Reply-To: EACHUS.98Oct14135537@spectre.mitre.org
In article <EACHUS.98Oct14135537@spectre.mitre.org>,
eachus@spectre.mitre.org (Robert I. Eachus) wrote:
> In article <702b25$30a$1@nnrp1.dejanews.com> dennison@telepath.com writes:
>
> > that can represent both 86,400 and 0.000_000_001, my poor
> > calculations tell me you'd need at least 47 bits. On a 32-bit
> > processor that would be tricky.
>
> You use 64-bits, and when necessary, multiprecision arithmetic.
> Remember that on many 32-bit processors, addition and subtraction of
> 64-bit numbers is either supported directly in the instruction set, or
> through instructions like add-with-carry.
Hmmm. I guess there's a bit of a hole in my education where multiprecision
integer arithmetic is concerned. I assume an add-with-carry instruction has
some way of handling when *two* bits need to be carried (eg: the msbit of
both previous operands was a 1, and there was a carry-in to that
bit-position). Or perhaps you have to add one to the second word of the
result if there was a carry and the msbit of the first word of the result is
0?
Either way it sounds like simple arithmetic will be significantly slower for
a Duration implemented in this way than one would typically expect of a
predefined type. I can certianly see where compiler vendors for some
real-time platforms might decide *not* to do that. So I don't think I can
safely assume that a Time_Span of a few microseconds will translate well into
Duration on any platform that this code may end up on (or even its current
platform, 'till I find out for sure).
--
T.E.D.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
next prev parent reply other threads:[~1998-10-15 0:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-13 0:00 Simple Real_Time.Time_Span question dennison
1998-10-13 0:00 ` Tucker Taft
1998-10-13 0:00 ` dennison
1998-10-13 0:00 ` David C. Hoos, Sr.
1998-10-13 0:00 ` dennison
1998-10-14 0:00 ` Robert I. Eachus
1998-10-14 0:00 ` Jonathan Guthrie
1998-10-15 0:00 ` dennison
1998-10-16 0:00 ` Tucker Taft
1998-10-16 0:00 ` dennison
1998-10-16 0:00 ` dewar
1998-10-17 0:00 ` Niklas Holsti
1998-10-14 0:00 ` Keith Thompson
1998-10-14 0:00 ` Niklas Holsti
1998-10-14 0:00 ` Niklas Holsti
1998-10-14 0:00 ` dewar
1998-10-14 0:00 ` dennison
1998-10-14 0:00 ` Matthew Heaney
1998-10-14 0:00 ` Robert I. Eachus
1998-10-15 0:00 ` dennison [this message]
1998-10-16 0:00 ` Robert I. Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox