Version 10 of Search

Updated 2011-04-21 14:21:53 by jdc

The Tclers Wiki search page is available at http://wiki.tcl.tk/_/search . This search corresponds to the search in titles box in the left column. It is based on sqlite's full text search [L1 ]. The search string is passed as MATCH argument.

Searches not ending with a * are done on page titles only. Searches ending with a * are done on page titles and page contents. To use a * in the search string, make sure to end your search with a space to only search titles and with a * to search titles and contents.

The sqlite in use at the wiki has been compiled with -DSQLITE_ENABLE_FTS3_PARENTHESIS so the Enhanced Query Syntax is available. This makes is possible to do the searches with an implicit AND as before but also allows you to refine your search using the AND, OR and NOT keywords.


Here below, you'll find the old content of page 2.


During Feb, 2002, Gerald Lester posted some basic Tcl code to news:comp.lang.tcl implementing version 0.1 of a Tcl script level package to perform packed decimal math. For a C based solution to precise math, see mpexpr.


   package provide packedDecimal 0.1

   namespace eval packedDecimal {
       namespace export add subtract multiply divide setDecimals

       variable decimals 2
       variable formatString {%d.%2.2d}
       variable carry 100
   }

   proc packedDecimal::add {a b} {
       variable decimals
       variable formatString

       scan $a %d.%d a1 a2
       scan $b %d.%d b1 b2
       incr a2 $b2
       if {[string length $a2] > $decimals} then {
           incr a1 1
           set a2 [string range $a2 1 end]
       }
       incr a1 $b1
       return [format $formatString $a1 $a2]
   }

   proc packedDecimal::subtract {a b} {
       variable decimals
       variable formatString
       variable carry

       scan $a %d.%d a1 a2
       scan $b %d.%d b1 b2
       incr a2 -$b2
       if {$a2 < 0} then {
           incr b1 1
           set a2 [expr {$carry + $a2}]
       }
       incr a1 -$b1
       return [format $formatString $a1 $a2]
   }

   proc packedDecimal::multiple {a b} {
       variable decimals
       variable formatString

       return -code error {Sorry, Multiple is not yet implemented!}
   }

   proc packedDecimal::divide {a b} {
       variable decimals
       variable formatString

       return -code error {Sorry, Divide is not yet implemented!}
   }

   proc packedDecimal::setDecimals {a} {
       variable decimals
       variable formatString
       variable carry 100

       set formatString [format {%%d.%%%d.%dd} $a $a]
       set decimals $a
       set carry [format "1%${a}.${a}d" 0]
       return;
   }

   proc packedDecimal::getDecimals {} {
       variable decimals

       return $decimals
   }