[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Integer division
- From: Jay Carlson <nop@...>
- Date: Wed, 21 Nov 2012 11:36:57 -0500
On Nov 21, 2012, at 10:40 AM, Roberto Ierusalimschy wrote:
>> If overflow raises an error, any computation completing without error
>> will be identical to an all-float version. I think.
>
> Not exactly, because a computation can "overflow" with floats and
> not overflow with 64-bit integers. ("overflow" here means lose of
> precision.)
Aha--I had assumed (without much basis) that integers were 32-bit.
More exactly, I assumed the integers were precisely represented in floating point. It becomes difficult to talk about the length of anything in portable C, of course. For many purposes, 32-bit precise integers really are enough but that is a value judgment.
There are 80- and 128-bit floating point formats on modern x86 CPUs, including in the x32 ABI, but I'm not sure that's relevant.
- References:
- Integer division, Dirk Laurie
- Re: Integer division, Petri Häkkinen
- Re: Integer division, Roberto Ierusalimschy
- Re: Integer division, Egor Skriptunoff
- Re: Integer division, Sven Olsen
- Re: Integer division, Roberto Ierusalimschy
- Re: Integer division, Jay Carlson
- Re: Integer division, Roberto Ierusalimschy
- Re: Integer division, Jay Carlson
- Re: Integer division, Roberto Ierusalimschy