Mathematical functions

Mathematical functions (such as sine and cosine) are replaced with a call to the Tcl mathfunc namespace. This does not require any additional syntax to access the namespace as it is called automatically. These are invoked by passing the Function followed by the value or values to evaluate to the expr command. Those functions that accept multiple arguments require that the arguments be comma delimited. The default Mathematical functions are listed below in alphabetical order. These functions require a specific syntax (for example expr {function(value,value)}) to be accessed, as described in the Computing mathematical expressions section that follows:

Function

Result

abs arg

Returns the absolute value of arg.

Numeric ...

Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.