1*89f15088Sdrh# 2012 June 18 2*89f15088Sdrh# 3*89f15088Sdrh# The author disclaims copyright to this source code. In place of 4*89f15088Sdrh# a legal notice, here is a blessing: 5*89f15088Sdrh# 6*89f15088Sdrh# May you do good and not evil. 7*89f15088Sdrh# May you find forgiveness for yourself and forgive others. 8*89f15088Sdrh# May you share freely, never taking more than you give. 9*89f15088Sdrh# 10*89f15088Sdrh#*********************************************************************** 11*89f15088Sdrh# 12*89f15088Sdrh# Tests of the sqlite3AtoF() function. 13*89f15088Sdrh# 14*89f15088Sdrh 15*89f15088Sdrhset testdir [file dirname $argv0] 16*89f15088Sdrhsource $testdir/tester.tcl 17*89f15088Sdrh 18*89f15088Sdrhexpr srand(1) 19*89f15088Sdrhfor {set i 1} {$i<10000} {incr i} { 20*89f15088Sdrh do_test 1.$i { 21*89f15088Sdrh set pow [expr {int((rand()-0.5)*100)}] 22*89f15088Sdrh set x [expr {pow((rand()-0.5)*2*rand(),$pow)}] 23*89f15088Sdrh set xf [format %.45e $x] 24*89f15088Sdrh set y [db eval "SELECT $xf=\$x"] 25*89f15088Sdrh if {!$y} { 26*89f15088Sdrh puts -nonewline \173[db eval "SELECT real2hex($xf), real2hex(\$x)"]\175 27*89f15088Sdrh db eval "SELECT $xf+0.0 AS a, \$x AS b" { 28*89f15088Sdrh puts [format "\n%.60e\n%.60e\n%.60e" $x $a $b] 29*89f15088Sdrh } 30*89f15088Sdrh } 31*89f15088Sdrh set y 32*89f15088Sdrh } {1} 33*89f15088Sdrh} 34*89f15088Sdrh 35*89f15088Sdrh 36*89f15088Sdrhfinish_test 37