Re: floating vs. double
- From: Rick Merrill <RickMerrill@xxxxxxxxxxxx>
- Date: Sun, 31 Dec 2006 20:52:32 -0500
Robert Wong wrote:
Hi there,
I was wondering if someone can explain this? There seems to be a big difference in the computation which the resultant is float vs. double. I'm not sure if I understand it myself.
Is this a compiler problem? or just a precision loss?
Robert
---- simple C/C++ cold
#include <stdio.h>
#include <stdlib.h>
void main(void)
{
long int value = 1028827861;
float lsb = 0.0009765625;
float answer;
double danswer;
answer = value * lsb;
danswer = value * lsb;
printf("\nFloat value Answer = %6.3f",answer);
printf("\nDouble value Answer = %6.3f",danswer);
}
double means twice as many bits as a single float...
.
- Next by Date: Problems Running Setup.exe Created by vs2005 Publish
- Next by thread: Problems Running Setup.exe Created by vs2005 Publish
- Index(es):
Relevant Pages
|