Re: sqrt() not working by Igor
Igor
Wed Sep 29 10:06:41 CDT 2004
"Keith La Force" <Keith La Force@discussions.microsoft.com> wrote in
message news:88954537-6A24-44A2-A298-551C0E677814@microsoft.com
> Hi, I have the following code sample:
>
> t = sqrt(discrim);
>
> where discrim is equal 4. However, instead of returning 2 it will
> return an incredibly large number or -1.n#IND00000000...
This most likely means that discrim is not 4 after all. Show some code.
This program compiles, runs and prints expected result:
#include <stdio.h>
#include <math.h>
int main()
{
double discrim = 4;
double t = sqrt(discrim);
printf("%g\n", t);
return 0;
}
--
With best wishes,
Igor Tandetnik
"On two occasions, I have been asked [by members of Parliament], 'Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?' I am not able to rightly apprehend the kind of
confusion of ideas that could provoke such a question." -- Charles
Babbage