Newsgroups: comp.lang.c Path: utzoo!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps From: flaps@dgp.toronto.edu (Alan J Rosenthal) Subject: Re: Floating point puzzle Message-ID: <8808111326.AA00158@explorer.dgp.toronto.edu> Keywords: floating point representation Organization: University of Toronto References: <3117@emory.uucp> <259@quintus.UUCP> Date: Thu, 11 Aug 88 08:06:25 EDT In article <259@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes: >TRAP: floating-point constants such as 1.0 are DOUBLE precision, so if the >compiler sees float x; ... x+1.0, it will do the addition in double >precision. In such a case, I do float one = 1.0; ... x+one... AACKK.. Pascal programmer detected. Use a cast. "x + (float)1.0" is the same as "x + one" in your example. At least, it should be. -- owotd (rot13): fabgentf