www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/13/07:40:08

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Q: detecting valid floating point numbers?
Date: Tue, 10 Dec 1996 09:09:36 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 43
Message-ID: <32AD1AC0.167E@LSTM.Ruhr-UNI-Bochum.De>
References: <58gvqc$26p AT newsfeed DOT cs DOT auc DOT dk>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Frank Frederiksen wrote:
> 
> Hi there,
> 
> In our research project we are transmitting some floating point
> numbers over a radio channel (the position of a mobile transmitter).
> 
> Our problem is that we sometimes get bit errors, i.e., some of the
> bits in the numbers are wrong. When we analyze the data, we then
> 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
> 
> 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?
> 

Dig in the sources of libm, there are some functions
like isNAN, isInf and so on. But, this will give
you only a warning when the number is really junked. 

You'd better look for CRC codes and such to trap
errors when the transmission failed but the number
happens to be valid, just off by some orders of magnitude.

-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* Voice/Fax Box: +49 2561 91371 2056                        *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019