Re: doubles or not
From: Roy Fine (rlfine_at_twt.obfuscate.net)
Date: 04/14/04
- Next message: Roger: "Re: doubles or not"
- Previous message: Carl Daniel [VC++ MVP]: "Re: assert"
- In reply to: bdg: "doubles or not"
- Next in thread: Roger: "Re: doubles or not"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 13 Apr 2004 23:31:18 -0400
"bdg" <ased@noo.com> wrote in message
news:emhgrAdIEHA.3988@tk2msftngp13.phx.gbl...
> "Avoid using doubles when integers will do..."
>
> How could this be true? Since whenever we have to represent a number to
> certain extent of accuracy of certain digits after decimal point and when
> even a float can not be enough for this, we may need doubles. Am I
missing
> something?
>
the point that you are missing is "..when integers will do". Never use a
double to store any of the natural numbers or their negatives or 0. Storing
doubles is expensive (8 bytes versus 4 bytes on some machines), and on most
hardware platforms, doing floating point math is more expensive than doing
integer math.
In places where an integer will not do, then consider using a double or a
float.
regards
roy fine
> Thanks!
>
>
>
- Next message: Roger: "Re: doubles or not"
- Previous message: Carl Daniel [VC++ MVP]: "Re: assert"
- In reply to: bdg: "doubles or not"
- Next in thread: Roger: "Re: doubles or not"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|