avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] float and double


From: Theodore Roth
Subject: Re: [avr-gcc-list] float and double
Date: Wed, 24 Jul 2002 17:17:36 -0600 (MDT)

Here's what I get when I run your program in gdb/simulavr:

address@hidden:~/dev/gps$ avr-gdb -x gdb.in
GNU gdb 2002-07-19-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=avr".
(gdb) file gps.elf
(gdb) target remote localhost:1212
0x00000000 in __vectors ()
(gdb) load
Loading section .data, size 0x44 lma 0xfc6
Loading section .text, size 0xfc6 lma 0x0
Start address 0x0, load size 4106
Transfer rate: 32848 bits in <1 sec, 31 bytes/write.
(gdb) break main
Breakpoint 1 at 0x40a: file gps.c, line 72.
(gdb) display current_fLat
(gdb) display fLatInteger
(gdb) display fLatFraction
(gdb) continue

Breakpoint 1, main () at gps.c:72
72      strcpy(r_buffer2,
"$GPGGA,203913.00,4825.7429,N,12320.5283,W,1,04,2.9,66.2,M,,M,,*5A\r\n");
3: fLatFraction = 0
2: fLatInteger = 0
1: current_fLat = 0
(gdb) next
74      highResolutionFloatParseGPSGGA();       //GPGGA high resolution
deg.123456 ie. 48.431185 or 123.342154  (6 decimal places)
3: fLatFraction = 0
2: fLatInteger = 0
1: current_fLat = 0
(gdb) next
77      }       //end of main
3: fLatFraction = 0.429048389
2: fLatInteger = 48
1: current_fLat = 48.4290466
(gdb) quit
The program is running.  Exit anyway? (y or n) y
address@hidden:~/dev/gps$

Of course, you expect 48.429048 and gdb/simulavr is giving 48.4290466

I'm not sure who's correct here (avrstudio or gdb).

Draw your own conclusions.

Ted Roth

On Wed, 24 Jul 2002, Jamie Morken wrote:

:) Hi Ted,
:)
:) Ok I am attaching some sourcecode.  Put a "watch" on these variables to see
:) the resolution loss.
:)
:) variables to watch: (line 58 is where the resolution is lost)
:) current_fLat
:) fLatInteger
:) fLatFraction
:)
:) cheers,
:) Jamie Morken
:)
:)


avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]