Re: Float comparison
- From: David Thompson <dave.thompson2@xxxxxxxxxxx>
- Date: Thu, 07 May 2009 08:31:08 GMT
On Wed, 29 Apr 2009 00:01:47 -0400, CBFalconer <cbfalconer@xxxxxxxxx>
wrote:
Flash Gordon wrote:So are the reals with the same exception.
... snip ...
You have also completely ignored the fact that I have presented
situations where the integer types *are* used as approximations.
So, is int just an approximation?
No, although it may be so used. It is intended to handle integers,
and, except for division, the set of integers is closed under
elementary arithmetic. People are quite familiar with the idea
that a division results in a quotient and a remainder, under which
condition the integer set remains closed.
But the bounded computer/C types int, long etc. aren't closed for
addition/subtraction and multiplication. (And with usual 2sC not quite
for negation.) The C unsigned integer types are closed (except
zerodiv) only because they implement Z sub N rather than Z.
You can't make these statements about FP values.
Computer (non-bignum*) integers are not the mathematical ones any more
than computer floats are mathematical reals. Although it seems in
practice programmers are more often able to cope with the deficiences
of almost-integers better than they do with almost-reals.
* Technically bignums aren't perfect either, but they're good enough
that they only break when you try to break them, whereas 32-bit and
64-bit break in some real programs if you're just a little careless.
We (at least I) don't have enough experience yet with 128 to see if it
is reliably big enough, but I'm not betting the farm on it today.
.
- Follow-Ups:
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- Prev by Date: Re: adapting getline
- Next by Date: Re: a doubt regarding global vars
- Previous by thread: Re: Float comparison
- Next by thread: Re: Float comparison
- Index(es):
Relevant Pages
|