Re: Another question about big floating point
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Thu, 21 Jun 2007 10:17:57 +0000
mike3 said:
<snip>
Carry on the addition is fairly easy even without a 64-bit type[...],
you just check to see if the sum of the digits is less than either. If
that is so, then it overflowed and hence there is a carry.
Then be sure you use unsigned integers, which are guaranteed to wrap
predictably. (You have no use for the sign bit anyway, since you're
doing sign and magnitude.)
But multiplication is more of a pain, since a simple x * y in N bits
will tell you *whether* a carry occurred, but not *how big* a carry
(unless you're using base 2). For that, you really need 2N bits.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.
- References:
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- From: Pascal Bourguignon
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- From: Pascal Bourguignon
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- From: robertwessel2@xxxxxxxxx
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- From: robertwessel2@xxxxxxxxx
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- From: robertwessel2@xxxxxxxxx
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- From: robertwessel2@xxxxxxxxx
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- From: Richard Heathfield
- Re: Another question about big floating point
- From: mike3
- Re: Another question about big floating point
- Prev by Date: Re: Poker Hand recognition! -CHALLENGE-
- Next by Date: Re: Poker Hand recognition! -CHALLENGE-
- Previous by thread: Re: Another question about big floating point
- Next by thread: Re: Another question about big floating point
- Index(es):
Relevant Pages
|