delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/24/13:35:27

From: Martin Ambuhl <mambuhl AT earthlink DOT net>
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
References: <MPG DOT 11db88b2dbac8f3298adc8 AT news DOT freeserve DOT net>
X-Posted-Path-Was: not-for-mail
X-Accept-Language: en
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 <math.h>, 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019