I don't know the range of numbers that we deal with, but floating numbers
may not exactly represent integers. It is possible to construct integers >
2^53 which are not exactly representable, I think (2^53)+1 cannot be
represented exactly. In fact, in such a case, 'a++' might end up equal to
'a' itself.

Now such huge numbers can be reached if the simulation were to run for
months (assuming only increments by one are made). Therefore it might not
be a problem. But floating point addition is costly compared to integer
addition, then why go for floating point?

On Mon, January 10, 2011 4:00 pm, nathan binkert wrote:
>> /** All counters are of 64-bit values. */
>> typedef double Counter;
>>
>> This line is from src/base/stats/types.hh. It seems intentional. But
>> this
>> will not work correctly for all arithmetic operations on variables of
>> type
>> Counter. Can't we use int64_t instead?
>
> What exactly won't work?  At one point (way long ago), I think
> counters were int64_t, but the change could have unforeseen effects.
>
>   Nate
> _______________________________________________
> m5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/m5-dev
>


--
Nilay

_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to