]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update the FAQ to include an entry about binary versus decimal numbers. (CVS 2648)
authordrh <drh@noemail.net>
Wed, 31 Aug 2005 02:46:21 +0000 (02:46 +0000)
committerdrh <drh@noemail.net>
Wed, 31 Aug 2005 02:46:21 +0000 (02:46 +0000)
FossilOrigin-Name: 0bbe73fccfe52700c2ae1122388764e81a78bc22

manifest
manifest.uuid
www/faq.tcl

index 9deb051f14ca1cb8238c80d66f76cce35b221c8b..62d8d0550bcb5ff1a058c56e6703ee2789a003a8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-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
@@ -279,7 +279,7 @@ F www/direct1b.gif 32b48b764244817b6b591898dc52a04299a7b8a7
 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
@@ -306,7 +306,7 @@ F www/tclsqlite.tcl 3df553505b6efcad08f91e9b975deb2e6c9bb955
 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
index 4f014875d98f71e90ff65050ff9d275775c2c85d..ad28f4be7f7e1b6658f9caa7c954805291735ea7 100644 (file)
@@ -1 +1 @@
-4c8d0a4c26e44088ffb9f21aa7641a5ebd0058be
\ No newline at end of file
+0bbe73fccfe52700c2ae1122388764e81a78bc22
\ No newline at end of file
index 1879ef48c152deeb9d7922cad54f14345c6087f3..1df6041e14ce166f0e4adc6dc0c32c30f24ce005 100644 (file)
@@ -1,7 +1,7 @@
 #
 # 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>}
 
@@ -484,6 +484,25 @@ faq {What is an SQLITE_SCHEMA error, and why am I getting one?} {
   </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.
 #############