From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: exp() doesn't work ! Date: 22 May 2001 17:43:01 GMT Organization: Aachen University of Technology (RWTH) Lines: 29 Message-ID: <9ee8f5$bru$1@nets3.rz.RWTH-Aachen.DE> References: NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 990553381 12158 137.226.32.75 (22 May 2001 17:43:01 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 22 May 2001 17:43:01 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Scott Sinclair wrote: > ////////////////////////////// > double x, y; > y = some_sensibly_small_number; > x = exp(y); > ///////////////////////////// > does NOT set x equal to e^y ???? Of course it doesn't. As given, it won't even compile, since it's incomplete (no enclosing function for the statements, no main() function. The real problem would have been revealed right away if only you had allowed GCC to help you. 'gcc -Wall -W -O2 -g' would have warned you about an implicit declaration of function 'exp'. Which in turn probably occurs because you forgot to #include I'll leave it as an exercise to you to find out what the exact consequences of this omission would be, and how that caused the badly incorrect result you got from your program. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.