Tk Library Source Code

View Ticket
Login
Ticket UUID: 1566460
Title: math-fuzzy-ManyCompares-1.1 fails with Tcl 8.5
Type: Bug Version: None
Submitter: dgp Created on: 2006-09-27 16:33:07
Subsystem: math Assigned To: arjenmarkus
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-11-08 15:10:55
Resolution: Fixed Closed By: arjenmarkus
    Closed on: 2006-11-08 08:10:55
Description:
==== math-fuzzy-ManyCompares-1.1 Compare fails due to
missing braces FAILED
==== Contents of test case:

   set tol_eq 0
   set tol_ne 0
   set tol_ge 0
   set tol_gt 0
   set tol_le 0
   set tol_lt 0

   for { set i -1000 } { $i <= 1000 } { incr i } {
      if { $i == 0 } continue

      #
      # NOTE: The braces in the assignment for y are
missing on purpose!
      #
      set x [expr {1.01/double($i)}]
      set y [expr (2.1*$x)*(double($i)/2.1)]

      if { [teq $y 1.01] } { incr tol_eq }
      if { [tne $y 1.01] } { incr tol_ne }
      if { [tge $y 1.01] } { incr tol_ge }
      if { [tgt $y 1.01] } { incr tol_gt }
      if { [tle $y 1.01] } { incr tol_le }
      if { [tlt $y 1.01] } { incr tol_lt }
   }
   set result [list $tol_eq $tol_ne $tol_ge $tol_gt
$tol_le $tol_lt]
   set intended {2000 0 2000 0 2000 0}
   set equal 1
   foreach r $result i $intended {
      if { $r != $i } {
         set equal 0
      }
   }
   set equal

---- Result was:
1
---- Result should have been (exact matching):
0
==== math-fuzzy-ManyCompares-1.1 FAILED
User Comments: arjenmarkus added on 2006-11-08 15:10:55:
Logged In: YES 
user_id=400048

Fixed the test: the failure was due to the changed default
for tcl_precision.
By explicitly setting the value, the previous behaviour has
been restored 
and the test succeeds. 

Note: the original value for tcl_precision is restored at
the end to ensure
consistent behaviour for other tests.

andreas_kupries added on 2006-09-27 23:42:16:
Logged In: YES 
user_id=75003

IIRC that code was written by Arjen. Assigned.