Re: [xml] Getting crazy with float parsing
- From: Aleksey Sanin <aleksey aleksey com>
- To: Igor Zlatkovic <igor stud fh-frankfurt de>
- Cc: Bjorn Reese <breese mail1 stofanet dk>, xml gnome org
- Subject: Re: [xml] Getting crazy with float parsing
- Date: Wed, 08 May 2002 12:26:40 -0700
Well, another option is to store both string representation and a float
value
inside LibXML. When you need to do any computation you use float value
but if you need to write the unchanged value back then you simple use the
string. I understand that this makes things more complex but I don't
think that
using trio all the time is a good idea.
Aleksey.
Igor Zlatkovic wrote:
Hello,
The latest baseline of trio (v 1.7) now handles these numbers
appropriately.
Consider the following statement
printf("%30.24f\n%30.24f\n%30.24f\n", 39413.80, 1.4, (2.0/3.0));
The libc printf on my machine outputs
39413.800000000002910383045673
1.399999999999999911182158
0.666666666666666629659233
whereas trio outputs
39413.800000000000000000000000
1.400000000000000000000000
0.666666666666667000000000
Let me know if you want to use this, and I'll upgrade libxml to the latest
trio baseline.
The printf in MS C-runtime 7 (XP) gives
39413.800000000003000000000000
1.399999999999999900000000
0.666666666666666630000000
which is not much different to what your libc does. I believe trio should be
used here.
Ciao
Igor
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]