diff options
| author | hobbs <hobbs> | 2005-09-30 01:05:20 (GMT) |
|---|---|---|
| committer | hobbs <hobbs> | 2005-09-30 01:05:20 (GMT) |
| commit | c499d178e893596b6beca8482cea9d354aa1cb98 (patch) | |
| tree | 084656e628a0e34ff96e740c066d28fc48d5703c | |
| parent | e5045d63cca70734c187dc944630c6add1cc6ca2 (diff) | |
| download | tcl-c499d178e893596b6beca8482cea9d354aa1cb98.zip tcl-c499d178e893596b6beca8482cea9d354aa1cb98.tar.gz tcl-c499d178e893596b6beca8482cea9d354aa1cb98.tar.bz2 | |
init value to (-)Inf for min/max expr functions to simplify code
| -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 } |
