Xref: utzoo comp.sys.ibm.pc:9513 comp.lang.c:5549 Path: utzoo!mnetor!uunet!husc6!bbn!gatech!mcnc!duke!drh From: drh@duke.cs.duke.edu (D. Richard Hipp) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: BUG in Turbo C v1.0 float ??? Message-ID: <10817@duke.cs.duke.edu> Date: 12 Dec 87 16:37:38 GMT References: <1304@phoenix.Princeton.EDU> Reply-To: drh@duke.UUCP (D. Richard Hipp) Organization: Duke University, Durham NC Lines: 32 >I came accross what could be a bug or I am missing somthing very obvious >but I know not. Here is a short bit of Turbo C code which seems to give >VERY absurd results. See the correction below: /**** code begins here ***/ #include#define reals float int print_f(float c); /* This line inserted. */ main() { reals c; c = -3.0; print_f(c); } print_f(c) reals c;{ printf("%f\n",c); } /***** code ends here ***/ Turboc was promoting the "c" in the function call in "main" to a double, then "print_f" interpreted the double as a float which caused your problem. Defining the function "print_f" before you use it should clear things up. -R.