-C Adding\sthe\sfirst\scut\sof\sthe\soptimizer\soverview\sdocument.\s(CVS\s2647)
-D 2005-08-31T01:49:59
+C Update\sthe\sFAQ\sto\sinclude\san\sentry\sabout\sbinary\sversus\sdecimal\snumbers.\s(CVS\s2648)
+D 2005-08-31T02:46:21
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F www/docs.tcl 6c0b2c567404b15bd46a0cda2dc69615a8e679a8
F www/download.tcl ceaa742d5b8137bce31e9dcc4e44494b38211490
F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
-F www/faq.tcl 49f31a703f74c71ce66da646aaf18b07a5042672
+F www/faq.tcl cdeb014235ac8030da593bde14a53240d4daa613
F www/fileformat.tcl 900c95b9633abc3dcfc384d9ddd8eb4876793059
F www/formatchng.tcl 053ddb73646701353a5b1c9ca6274d5900739b45
F www/fullscanb.gif f7c94cb227f060511f8909e10f570157263e9a25
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 14668c85b87f7c9b83efd592ddc693522c764969
-R 3e38efd9bc5b22f2b9f7cfdf76added5
+P 4c8d0a4c26e44088ffb9f21aa7641a5ebd0058be
+R 8c9dcafaf8c56c90363aaddb93c3711c
U drh
-Z f4986d89db2306d81b4b595a9239ef43
+Z e855546ae219fc0150427c3e7e1f6fde
-4c8d0a4c26e44088ffb9f21aa7641a5ebd0058be
\ No newline at end of file
+0bbe73fccfe52700c2ae1122388764e81a78bc22
\ No newline at end of file
#
# Run this script to generated a faq.html output file
#
-set rcsid {$Id: faq.tcl,v 1.29 2005/06/16 19:48:40 drh Exp $}
+set rcsid {$Id: faq.tcl,v 1.30 2005/08/31 02:46:21 drh Exp $}
source common.tcl
header {SQLite Frequently Asked Questions</title>}
</pre></blockquote>
}
+faq {Why does ROUND(9.95,1) return 9.9 instead of 10.0?
+ Shouldn't 9.95 round up?} {
+ <p>SQLite uses binary arithmetic and in binary, there is no
+ way to write 9.95 in a finite number of bits. The closest to
+ you can get to 9.95 in a 64-bit IEEE float (which is what
+ SQLite uses) is 9.949999999999999289457264239899814128875732421875.
+ So when you type "9.95", SQLite really understands the number to be
+ the much longer value shown above. And that value rounds down.</p>
+
+ <p>This kind of problem comes up all the time when dealing with
+ floating point binary numbers. The general rule to remember is
+ that most fractional numbers that have a finite representation in decimal
+ do not have a finite representation in binary. And so they are
+ approximated using the closest binary number available. That
+ approximation is usually very close, but it will be slightly off
+ and in some cases can cause your results to be a little different
+ from what you might expect.</p>
+}
+
# End of questions and answers.
#############