logo       

Re: [ gpsdrive ] ..truncated decimals problem: msg#00106

Subject: Re: [ gpsdrive ] ..truncated decimals problem
fredag 24. mars 2006, 09:23, skrev Joerg Ostertag:
> On Monday 06 March 2006 20:19, Nils Olav Fossum wrote:
> > fredag 3. mars 2006, 09:54, skrev D.S.E:
> > > hi,
> > >
> > > I wonder, why no one else has this problem anymore:
> > >
> > > the decimals of the coordinates were always truncated in the cvs
> > > version of gpsdrive, so I tried to find the problem with my limited C
> > > knowledge. My currently used version is GpsDrive
> > > v2.10pre3-cvs-20060213.
> > > The attached patch fixes this for me, although I don't know why...
> > >
> > > Maybe I should mention, that the following line in gpsmisc.c doesn't
> > > change anything, whether it's included or not:
> > >
> > >   setlocale(LC_NUMERIC, "en_US");
> >
> > Ah, this one bite me :-/
> >
> > Activating the print at the end of the  coordinate_string2gdouble
> > Function gives this when placing a new waypoint:
> >
> > coordinate_string2gdouble(62.000000)-->62,000000
> > coordinate_string2gdouble(10.000000)-->10,000000
> > coordinate_string2gdouble(61.798594)-->61,000000
> > coordinate_string2gdouble(9.850945)-->9,000000
> > way.txt reloaded
>
> For testing without the GUI
>       gpsdrive -T -D 10
> should give you something like:
>
> Testing coordinate_string2gdouble()
>         0: coordinate_string2gdouble('0')       --> 0
>         1: coordinate_string2gdouble('0.0')     --> 0
>         2: coordinate_string2gdouble('0,0')     --> 0
>         3: coordinate_string2gdouble('1')       --> 1
>         4: coordinate_string2gdouble('1.0')     --> 1
>         5: coordinate_string2gdouble('1,0')     --> 1
>         6: coordinate_string2gdouble('12')      --> 12
>         7: coordinate_string2gdouble('12.0')    --> 12
>         8: coordinate_string2gdouble('12,0')    --> 12
>         9: coordinate_string2gdouble('-12')     --> -12
>         10: coordinate_string2gdouble('-12.0')  --> -12
>         11: coordinate_string2gdouble('-12,0')  --> -12
>         12: coordinate_string2gdouble('12W')    --> 12
>         13: coordinate_string2gdouble('12.0W')  --> 12
>         14: coordinate_string2gdouble('12,0W')  --> 12
>         15: coordinate_string2gdouble('121.7654789')    --> 121.765
>         16: coordinate_string2gdouble('121,7654789')    --> 121.765
>         17: coordinate_string2gdouble(' 121.7654789 ')  --> 121.765
>         18: coordinate_string2gdouble(' 121,7654789 ')  --> 121.765
>         19: coordinate_string2gdouble(' 121,7654789 ')  --> 121.765
>         20: coordinate_string2gdouble(' 121,7654789     ')      --> 121.765
>         21: coordinate_string2gdouble('
> 121,7654789     ')      --> 121.765
>         22: coordinate_string2gdouble(' 121,7654789     ')      --> 121.765
>         23: coordinate_string2gdouble('-121.7654789')   --> -121.765
>         24: coordinate_string2gdouble('-121,7654789')   --> -121.765
>         25: coordinate_string2gdouble(' -121.7654789 ') --> -121.765
>         26: coordinate_string2gdouble(' -121,7654789 ') --> -121.765
>         27: coordinate_string2gdouble(' -121,7654789 ') --> -121.765
>         28: coordinate_string2gdouble(' -121,7654789    ')      -->
> -121.765 29: coordinate_string2gdouble('
> -121,7654789    ')      --> -121.765
>         30: coordinate_string2gdouble(' -121,7654789    ')      -->
> -121.765 31: coordinate_string2gdouble('121.7654789E')   --> 121.765 32:
> coordinate_string2gdouble('121,7654789E')   --> 121.765 33:
> coordinate_string2gdouble(' 121.7654789E ') --> 121.765 34:
> coordinate_string2gdouble(' 121,7654789E ') --> 121.765 35:
> coordinate_string2gdouble(' 121,7654789E ') --> 121.765 36:
> coordinate_string2gdouble(' 121,7654789E    ')      --> 121.765 37:
> coordinate_string2gdouble('
> 121,7654789E    ')      --> 121.765
>         38: coordinate_string2gdouble(' 121,7654789E    ')      --> 121.765
>         39: coordinate_string2gdouble('12°21'E')       --> 12.35
>         40: coordinate_string2gdouble('12°21'W')       --> -12.35
>         41: coordinate_string2gdouble('12°21'N')       --> 12.35
>         42: coordinate_string2gdouble('12°21'S')       --> -12.35
>         43: coordinate_string2gdouble('12°21'7''E')    --> 12.3519
>
> Testing coordinate_string2gdouble()
>
> Testing coordinate2gchar()
>         12.1 --> '12°05'60.00''E'
>         -12.1 --> '12°05'60.00''W'
>         12.1 --> '12°05'60.00''N'
>         -12.1 --> '12°05'60.00''S'

Yes, this is the output I get with
  setlocale(LC_NUMERIC, "C"); 



And with 
  setlocale(LC_NUMERIC, "en_US");

Testing coordinate_string2gdouble()
        0: coordinate_string2gdouble('0')       --> 0
        1: coordinate_string2gdouble('0.0')     --> 0
        2: coordinate_string2gdouble('0,0')     --> 0
        3: coordinate_string2gdouble('1')       --> 1
        4: coordinate_string2gdouble('1.0')     --> 1
        5: coordinate_string2gdouble('1,0')     --> 1
        6: coordinate_string2gdouble('12')      --> 12
        7: coordinate_string2gdouble('12.0')    --> 12
        8: coordinate_string2gdouble('12,0')    --> 12
        9: coordinate_string2gdouble('-12')     --> -12
        10: coordinate_string2gdouble('-12.0')  --> -12
        11: coordinate_string2gdouble('-12,0')  --> -12
        12: coordinate_string2gdouble('12W')    --> 12
        13: coordinate_string2gdouble('12.0W')  --> 12
        14: coordinate_string2gdouble('12,0W')  --> 12
        15: coordinate_string2gdouble('121.7654789')    --> 121
!!!! ERROR
        coordinate_string2gdouble('121.7654789')        --> 121
        16: coordinate_string2gdouble('121,7654789')    --> 121
!!!! ERROR
        coordinate_string2gdouble('121,7654789')        --> 121
        17: coordinate_string2gdouble(' 121.7654789 ')  --> 121
!!!! ERROR
        coordinate_string2gdouble(' 121.7654789 ')      --> 121
        18: coordinate_string2gdouble(' 121,7654789 ')  --> 121
!!!! ERROR
        coordinate_string2gdouble(' 121,7654789 ')      --> 121
        19: coordinate_string2gdouble(' 121,7654789 ')  --> 121
!!!! ERROR
        coordinate_string2gdouble('     121,7654789 ')  --> 121
        20: coordinate_string2gdouble(' 121,7654789     ')      --> 121
!!!! ERROR
        coordinate_string2gdouble(' 121,7654789 ')      --> 121
        21: coordinate_string2gdouble('
121,7654789     ')      --> 121
!!!! ERROR
        coordinate_string2gdouble('
121,7654789     ')      --> 121
        22: coordinate_string2gdouble(' 121,7654789     ')      --> 121
!!!! ERROR
        coordinate_string2gdouble(' 121,7654789 ')      --> 121
        23: coordinate_string2gdouble('-121.7654789')   --> -121
        24: coordinate_string2gdouble('-121,7654789')   --> -121
        25: coordinate_string2gdouble(' -121.7654789 ') --> -121
        26: coordinate_string2gdouble(' -121,7654789 ') --> -121
        27: coordinate_string2gdouble(' -121,7654789 ') --> -121
        28: coordinate_string2gdouble(' -121,7654789    ')      --> -121
        29: coordinate_string2gdouble('
-121,7654789    ')      --> -121
        30: coordinate_string2gdouble(' -121,7654789    ')      --> -121
        31: coordinate_string2gdouble('121.7654789E')   --> 121
        32: coordinate_string2gdouble('121,7654789E')   --> 121
        33: coordinate_string2gdouble(' 121.7654789E ') --> 121
        34: coordinate_string2gdouble(' 121,7654789E ') --> 121
        35: coordinate_string2gdouble(' 121,7654789E ') --> 121
        36: coordinate_string2gdouble(' 121,7654789E    ')      --> 121
        37: coordinate_string2gdouble('
121,7654789E    ')      --> 121
        38: coordinate_string2gdouble(' 121,7654789E    ')      --> 121
        39: coordinate_string2gdouble('12°21'E')       --> 12,35
        40: coordinate_string2gdouble('12°21'W')       --> -12,35
        41: coordinate_string2gdouble('12°21'N')       --> 12,35
        42: coordinate_string2gdouble('12°21'S')       --> -12,35
        43: coordinate_string2gdouble('12°21'7''E')    --> 12,3519

Testing coordinate_string2gdouble()

Testing coordinate2gchar()
        12,1 --> '12°05'60,00''E'
!!!! ERROR
        -12,1 --> '12°05'60,00''W'
!!!! ERROR
        12,1 --> '12°05'60,00''N'
!!!! ERROR
        -12,1 --> '12°05'60,00''S'
!!!! ERROR
--
This message was part of the gpsdrive mailinglist
unsubscribing can be done by sending a mail containing a body of:
-quote--
unsubscribe gpsdrive
-unquote--
to majordomo-ahljRfkWE0EwtzFM8z8+AfP6llvjuJOh@xxxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    politics.lenini...    audio.emagic.ex...    tex.texinfo.gen...    handhelds.linux...    ietf.sipping/20...    lang.erlang.gen...    cygwin.talk/200...    yellowdog.gener...    mozilla.devel.l...    xfree86.newbie/...    openbsd.ports/2...    db.oracle.devel...    kde.kalyxo.deve...    user-groups.lin...    bbc.cvs/2003-04...    gnu.libtool.bug...    redhat.k12osn/2...    emulators.wine....    freebsd.devel.d...    search.xapian.g...    java.izpack.use...    network.mrtg.us...    windows.total-c...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe