summaryrefslogtreecommitdiffstats
path: root/library/init.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs>2005-09-30 01:05:20 (GMT)
committerhobbs <hobbs>2005-09-30 01:05:20 (GMT)
commit5cb1ae055b6d9a99da40a8369a2ef4d020ca9350 (patch)
tree084656e628a0e34ff96e740c066d28fc48d5703c /library/init.tcl
parent33d8a64399b54b08c5bd702183b92c4c9548e156 (diff)
downloadtcl-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/init.tcl')
-rw-r--r--library/init.tcl24
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
}