From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: Forgive me, for I have sinned without including math.h Date: Thu, 24 Jun 1999 12:52:45 -0400 Content-Transfer-Encoding: 7bit References: X-Posted-Path-Was: not-for-mail X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-ELN-Date: 24 Jun 1999 16:51:22 GMT X-ELN-Insert-Date: Thu Jun 24 09:55:22 1999 Organization: Nocturnal Aviation Lines: 23 Mime-Version: 1.0 NNTP-Posting-Host: 1cust145.tnt12.nyc3.da.uu.net Message-ID: <3772625D.2AE5C4EB@earthlink.net> X-Mailer: Mozilla 4.6 [en] (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Andrew R. Gillett" wrote: > > I just found a strange anomaly. I had two identical functions in > different programs using sin(). Each program gave significantly different > results. I eventually found that one of them wasn't including math.h. > Adding it fixed the problem. > > I found that if I called sin() without #including math.h, the compiler > would think it returned a fix instead of a double. I found this out when > I was doing some tests with fprintf and sin - the compiler told me that a > fix couldn't be passed through a ... There is no anomaly. When you use a function without a declaration (either a prototype, in this case from , or definition), it is assumed to returned int. This has always been true in C, although it may soon start to be an error instead. -- Martin Ambuhl (mambuhl AT earthlink DOT net) Ah! but it is something to have at least the choice of nightmares. - Joseph Conrad