Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-05-14
17:19 • Closed ticket [1963661fff]: ::math::min returning false minimum plus 6 other... artifact: ec2d9207af user: dkf
17:16 • Ticket [1963661fff]: 4 changes artifact: c864c551a4 user: nobody
08:59 • New ticket [1963661fff]. artifact: b5f3125496 user: nobody

::math::min returning false minimum

Closed / Invalid1963661fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2008-05-14 08:59:58
Versions:
Tcl/Tk: ActiveTcl 8.5.1.0
Math-Package: 1.2.4
OS: Windows XP Professional Version 2002 SP2

The procedure '::math::min' returns a false minimum when an argument is not a number and starts with '-' or '+'.

Sample Code:
package require math
::math::min 1 2 -abc

The sample code above will return '-abc' instead of '1'.
nobodyplain2008-05-14 17:16:37
Logged In: NO 

::math::min is part of tcllib, not tcl.
It uses "<" for comparison and thus gets string
comparison for non-numeric values.

In 8.5 tcl got ::tcl::mathfunc::min which is purely numeric
dkf Closed ticket [1963661fff]. [History diff]2008-05-14 17:19:39
Log in (anonymous is fine) to add a comment.