Date: Thu, 12 Dec 1996 22:23:25 -0600 (CST) From: Alan Hightower To: Frank Frederiksen cc: djgpp AT delorie DOT com Subject: Re: Q: detecting valid floating point numbers? In-Reply-To: <58gvqc$26p@newsfeed.cs.auc.dk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On 9 Dec 1996, Frank Frederiksen wrote: > sometimes get a 'exiting due to SIGFPE' followed by a stack trace. > > When we symify the program the first two lines are: > __doprnt+1432 > _fprintf+105 compile the program with the -g option. this adds debugging info that will allow symify to print line numbers as well as functions. It will also allow you to use debuggers such as gdb to step through the program. > So, is there a (simple)way of detecting if a floating point number > is legal, before printing it, or do we have to investigate the > numbers individually to see if they are valid numbers? Unless bits 30-23 in a single precision number are all ones, it should be a valid floating point representation. The only exception might be if fprintf or other specific fp functions barf on certain legal but unusual bit patterns like denormals or -0, in which case bits 30-23 containing all zeros might cause complications. / +-----------------------------------------------+ /// / / Alan Lee Hightower University of \ // / / Venture Systems, Inc. Arkansas - Fay. \ //// _/ / +-----------------------------------------------+ \_ //// / \___/ / "The world has yet to encompass true glory, glory / \_ that can only be realized through BarneyDOOM!" /,)-_( \_ \ (/ \\ / \\\\ ahightow AT comp DOT uark DOT edu - Syntax Error // alh AT engr DOT engr DOT uark DOT edu ((` ahightow AT alh DOT mslip DOT engr DOT uark DOT edu