And more tests. Perhaps one of the problems in converting real -> text?

--------------------------------------------------------------------

#!/usr/local/bin/tclsh8.6

# do_test atof1-1.$i.1

package require platform
puts "\nplatform: [platform::generic]"
puts "sqlite version: [package require sqlite3]"
sqlite db :memory:

set xf [format %.32e 4.40035364203127786031058909193863e+118]
set x  [expr {1*$xf}]

puts [format "\nxf = %.32e\nx  = %.15e"   $xf $x]
puts [format "\nxf = %.60e\nx  = %.60e\n" $xf $x]

puts [format "db eval \"SELECT \$xf=\\\$x\" : %s" [db eval "SELECT $xf=\$x"]]
puts [format "expr { \$xf == \$x }       : %s\n"  [expr { $xf == $x }]]

puts [format "db eval \"SELECT \$xf\"  = %.32e" [db eval "SELECT $xf"]]
puts [format "db eval \"SELECT \\\$xf\" = %.32e" [db eval "SELECT \$xf"]]
puts [format "db eval \"SELECT \\\$x\"  = %.32e" [db eval "SELECT \$x"]]

db eval "CREATE TABLE t (a text, b real, c int)"
db eval "INSERT INTO t VALUES($xf,\$xf,1)"
db eval "INSERT INTO t VALUES(\$xf,$xf,2)"
db eval "INSERT INTO t VALUES($xf,$xf,3)"
db eval "INSERT INTO t VALUES(\$xf,\$xf,4)"

puts "\ndb eval \"CREATE TABLE t (a text, b real, c int)\"\n"
db eval {SELECT * FROM t} values {
            parray values
                puts ""
        }

db close

--------------------------------------------------------------------
FreeBSD 9.1-RELEASE #0 r243826: Tue Dec  4 06:55:39 UTC 2012
r...@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
tcl-8.6.0

platform: freebsd-ix86
sqlite version: 3.7.15.1

xf = 4.40035364203127786031058909193863e+118
x  = 4.400353642031278e+118

xf = 4.400353642031277860310589091938627241607447857305708019118800e+118
x  = 4.400353642031277860310589091938627241607447857305708019118800e+118

db eval "SELECT $xf=\$x" : 0
expr { $xf == $x }       : 1

db eval "SELECT $xf"  = 4.40035364203127696441269222081694e+118
db eval "SELECT \$xf" = 4.40035364203127786031058909193863e+118
db eval "SELECT \$x"  = 4.40035364203127786031058909193863e+118

db eval "CREATE TABLE t (a text, b real, c int)"

values(*) = a b c
values(a) = 4.40035364203128e+118
values(b) = 4.400353642031278e+118
values(c) = 1

values(*) = a b c
values(a) = 4.40035364203128e+118
values(b) = 4.400353642031277e+118
values(c) = 2

values(*) = a b c
values(a) = 4.40035364203128e+118
values(b) = 4.400353642031277e+118
values(c) = 3

values(*) = a b c
values(a) = 4.40035364203128e+118
values(b) = 4.400353642031278e+118
values(c) = 4

--------------------------------------------------------------------
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to