Re: Linux printf funny
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Tue, 27 Feb 2007 16:24:57 -0500
Paul Burke wrote:
I'm converting an application from Windows console to Linux, and
the changeover has gone remarkably easily (considering that I know
very little about Linux), until now.
No problem installing GCC, KDevelop, FTDI USB drivers, remarkably
few changes to recompile the code... but printf fails after about
half-a-dozen calls. A float value prints as "nan"- not a number I
asume, rather than what I eat with an Indian takeout. This value
is computed from two int values (actually a weight and a tare
reading) and multiplied by a scale factor (1.0 for the tests).
The funny thing is that I can't see anything different about the
weight or the tare value between instances that print and those
that fail. There is the expected one-or-two bits wobble in the
weight reading, but the values only oscillate between plus and
minus one relative to the tare. Once it fails, it seems to be
sticky- it doesn't recover even when the readings are identical
to before the nan.
So, please you Linux/ GCC experienced people- what absolutely
basic item of knowledge am I lacking?
Since you didn't publish any code, we have no idea. The only thing
I can point out is that any operation on a NAN yields another NAN.
You don't need to know anything about Linux if you stick to ISO
standard C.
Cut the program down to a minimum that demonstrates the problem,
and doesn't use non-standard C (you can fake inputs by using files)
and publish that if the process hasn't made you solve the actual
problem.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
.
- References:
- Linux printf funny
- From: Paul Burke
- Linux printf funny
- Prev by Date: Color LCD
- Next by Date: Re: Internet Embedded
- Previous by thread: Re: Linux printf funny
- Next by thread: Internet Embedded
- Index(es):
Relevant Pages
|