www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/13/05:11:35

From: Alexander Lehmann <lehmann AT mathematik DOT th-darmstadt DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Q: detecting valid floating point numbers?
Date: 9 Dec 1996 20:42:50 GMT
Organization: GMD Darmstadt, Germany
Lines: 38
Message-ID: <58htka$il9@mars.darmstadt.gmd.de>
References: <58gvqc$26p AT newsfeed DOT cs DOT auc DOT dk>
NNTP-Posting-Host: fb0401.mathematik.th-darmstadt.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Frank Frederiksen <ff AT kom DOT auc DOT dk> 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?

Depending on the frequency of transmission errors, maybe you could use
some kind of error correction code, e.g. Hamming codes to correct the
incoming data (see any book about signal theory or whatever this is
called in english).

If that is not possible, you may be able to detect valid floating
point numbers by looking at the different parts of the numbers
(exponent, mantissa) and doing some range checks. Usually the numbers
are represented by IEEE floats, which should be easy to check, at
least as long as you only have one cpu architecture (but assuming that
you pass the data unencoded, you have one endian only anyway).


bye, Alexander

-- 
Alexander Lehmann,                                  |  "On the Internet,
alex AT hal DOT rhein-main DOT de  (MIME, NeXT)                |   nobody knows
lehmann AT mathematik DOT th-darmstadt DOT de (MIME)           |   you're a dog."
<URL:http://home.pages.de/~lehmann/>

- Raw text -


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