Closed GoogleCodeExporter closed 9 years ago
Hello
I think I have same issue with Ubuntu 10.10. For me the problem was that atof
function in xmlreader.h was returning integer. I don't know much of coding or
compilers so I just made my own function to return double and now the
preprocessor is working right.
Original comment by jekkuka...@gmail.com
on 5 Jan 2011 at 4:44
Sorry for the late reply, I have been busy during the last few days.
That's a weird behavior you encounter there. I could not reproduce it with any
computer available to me.
The only thing I can think of right now is that atof might be using your locale
settings, i.e., use "," instead of "." as a decimal separator. Can you check
what results you get for "atof( "1.5" )" and "atof( "1,5" )" or whatever your
local settings might be?
If this can be confirmed I have to replace atof with local-independent routines
as the OSM input always uses '.' as a separator.
Original comment by veaac.fd...@gmail.com
on 5 Jan 2011 at 8:59
Hello
I did some testing with clean project only main function and cstdlib and
iostream included. atof returns 1.5 as 1.5 and 1,5 as 1. Then I added
QApplication to includes and "QApplication app(argc, argv);" to the top of main
function. Now atof returns 1.5 as 1 and 1,5 as 1.5.
That same happens inside MoNav's code, I think.
Original comment by jekkuka...@gmail.com
on 6 Jan 2011 at 4:10
$ cat foo.c
#include <stdio.h>
#include <stdlib.h>
int main() {
printf("1,50 → %.2f\n", atof("1,5"));
printf("1.50 → %.2f\n", atof("1.5"));
}
$ ./a.out
1,50 → 1.00
1.50 → 1.50
$
It seems it's doing the "right" thing. However, a locale-agnostic
implementation would be better in any case, I'd say.
Original comment by d.pale...@gmail.com
on 9 Jan 2011 at 8:55
(so yes, maybe it's something related to QApplication)
Original comment by d.pale...@gmail.com
on 9 Jan 2011 at 8:57
...and, strange, but yes, my locale has "," as decimal separator:
Compare:
$ df -h | grep sdb
/dev/sdb1 7,4G 20K 7,4G 1% /media/PHOTOSD
$ LANG=C df -h | grep sdb
/dev/sdb1 7.4G 20K 7.4G 1% /media/PHOTOSD
(sorry for the multiple comments)
Original comment by d.pale...@gmail.com
on 9 Jan 2011 at 9:12
Nice piece of investigative work.
Could you try whether r404 fixes the behavior?
Original comment by veaac.fd...@gmail.com
on 9 Jan 2011 at 9:56
I couldn't backport it to 0.2, so I checked it out. And yes, it works great :)
When will you release a new version I could package? :)
Thanks!
Original comment by d.pale...@gmail.com
on 9 Jan 2011 at 10:43
Works great! Thank you
Original comment by jekkuka...@gmail.com
on 9 Jan 2011 at 11:26
Original comment by veaac.fd...@gmail.com
on 13 Jan 2011 at 11:57
Original issue reported on code.google.com by
d.pale...@gmail.com
on 3 Jan 2011 at 5:50Attachments: