Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!aplcen!haven!ncifcrf!nlm-mcs!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Floating variables Message-ID: <11705@smoke.BRL.MIL> Date: 29 Nov 89 19:45:10 GMT References: <1404@utkcs2.cs.utk.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article <1404@utkcs2.cs.utk.edu> wozniak@utkux1.utk.edu (Bryon Lape) writes: >In C, are floating point numbers allowed to hold negative numbers? Of course. >I am trying to convert a BASIC programme and I must have negative >calculations for floating point numbers. So far the fern leaf is not >generating. I can't help you with gardening, but in C you need to be careful when converting floating-point to integer type; some implementations truncate toward zero, others toward minus infinity. Also, don't expect the result of a floating-point calculation that "should" be an exact integer value to actually be one. You might get 0.9999999 instead of 1.0000000, and truncation of this will surprise you.