diff options
author | hobbs <hobbs> | 2005-09-30 01:05:20 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2005-09-30 01:05:20 (GMT) |
commit | 5cb1ae055b6d9a99da40a8369a2ef4d020ca9350 (patch) | |
tree | 084656e628a0e34ff96e740c066d28fc48d5703c /library | |
parent | 33d8a64399b54b08c5bd702183b92c4c9548e156 (diff) | |
download | tcl-5cb1ae055b6d9a99da40a8369a2ef4d020ca9350.zip tcl-5cb1ae055b6d9a99da40a8369a2ef4d020ca9350.tar.gz tcl-5cb1ae055b6d9a99da40a8369a2ef4d020ca9350.tar.bz2 |
init value to (-)Inf for min/max expr functions to simplify code
Diffstat (limited to 'library')
-rw-r--r-- | library/init.tcl | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/library/init.tcl b/library/init.tcl index 9551a1c..cffe809 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -3,7 +3,7 @@ # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # -# RCS: @(#) $Id: init.tcl,v 1.82 2005/09/29 23:16:29 hobbs Exp $ +# RCS: @(#) $Id: init.tcl,v 1.83 2005/09/30 01:05:20 hobbs Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -103,13 +103,10 @@ namespace eval tcl { return -code error \ "too few arguments to math function \"min\"" } - set val [lindex $args 0] - # This will handle forcing the numeric value without - # ruining the interval type of a numeric object - if {[catch {expr {double($val)}} err]} { - return -code error $err - } - foreach arg [lrange $args 1 end] { + set val Inf + foreach arg $args { + # This will handle forcing the numeric value without + # ruining the interval type of a numeric object if {[catch {expr {double($arg)}} err]} { return -code error $err } @@ -122,13 +119,10 @@ namespace eval tcl { return -code error \ "too few arguments to math function \"max\"" } - set val [lindex $args 0] - # This will handle forcing the numeric value without - # ruining the interval type of a numeric object - if {[catch {expr {double($val)}} err]} { - return -code error $err - } - foreach arg [lrange $args 1 end] { + set val -Inf + foreach arg $args { + # This will handle forcing the numeric value without + # ruining the interval type of a numeric object if {[catch {expr {double($arg)}} err]} { return -code error $err } |