Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!crdgw1!control!kassover From: kassover@control.crd.ge.com (David Kassover) Newsgroups: comp.graphics Subject: Re: Fracturing self-intersecting polygons into trapezoids Keywords: polygon,intersection,double precision, accuracy Message-ID: <5637@crdgw1.crd.ge.com> Date: 1 Mar 90 00:01:15 GMT References: <20408@versatc.versatec.COM> Sender: news@crdgw1.crd.ge.com Organization: Aule-Tek, Inc. Lines: 32 In article <20408@versatc.versatec.COM> ritter@versatc.versatec.COM (Jack Ritter) writes: ... > > How can I do double precision fixed-point arithmetic in C? >-- Easy (to say, anyway) you write a bunch of routines (maybe you want them to be functions) that explicitly do the arithmetic you want to do. Then you call the routines instead of combine variables with operators. E.G. for addition, you add the two lower order segments together, checking for overflow. Then you add the two higher order segments, and add 1 if there was overflow from the previous addition. Then you glom both parts back into your data structure. If this were Ada, which it is not (If I were vulgar...*), you could write your functions carefully and overload them onto the operators... I'm not a C guru, so I don't know if integer overflow is detectable in any standard form of the language... Or maybe you could ignore overflow, then examine the two lower order segments carefully to determine if there *should* have been an overflow? It begins to be not hardly worth the effort. Perhaps you can get permission to implement THESE ROUTINES in local assembler and call them from your main program.