Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!rochester!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!cs4w+ From: cs4w+@andrew.cmu.edu (Charles William Swiger) Newsgroups: comp.sys.apple2 Subject: Re: Help with Floats in Hyper C Message-ID: Date: 23 Jun 91 00:23:01 GMT References: <863@generic.UUCP> Organization: Carnegie Mellon, Pittsburgh, PA Lines: 44 In-Reply-To: <863@generic.UUCP> >Two things to note. Floats are stored in a different format >from Ints. I think 0 is equivalent to both, but that is the >end of all similarities. Certain compilers automatically >coerce variables from one type to another, HyperC does not. >The programmer must explicitly tell the compiler to test >Ints as Floats doing the neccessary conversions beforehand >to make the comparison meaning full. Casting lets the >compiler know what you want to do. This should do the >trick and is more portable (although still not good C code) >than that in K&R's book. Your comments about what is required to produce legal C code are simply not correct...you can check with either K&R, the ANSI C specification, or various other C reference materials. You should not need to convert a float to an int in an assignment, nor should you have to convert an int to a float in order to perform floating point arithmetic. That you have to in order to produce executable code for Hyper C means that Hyper C is a seriously deficient implementation of the language. Unfortunately, the size requirements for a correct C compiler are (admittedly) fairly extensive: Required programs and size in kilobytes, for the DECstation 3100 C compiler: cc = 86 C compiler ccom = 278 C front end cpp = 49 macro pre-processor ld = 213 loader High performance code optimizers (optional): ugen = 331 ucode generator ujoin = 73 binary ucode and symbol table joiner umerge = 119 procedure integrator uopt = 454 global ucode optimizer usplit = 57 binary ucode and symbol table splitter Grand total: 1.66 megabytes >Eric Mcgillicuddy@pnet91.cts.com -- Charles William Swiger cs4w+@andrew.cmu.edu