1# 2# fmath.tcl -- 3# 4# Contains a package of procs that interface to the Tcl expr command built-in 5# functions. These procs provide compatibility with older versions of TclX and 6# are also generally useful. 7#------------------------------------------------------------------------------ 8# Copyright 1993-1999 Karl Lehenbauer and Mark Diekhans. 9# 10# Permission to use, copy, modify, and distribute this software and its 11# documentation for any purpose and without fee is hereby granted, provided 12# that the above copyright notice appear in all copies. Karl Lehenbauer and 13# Mark Diekhans make no representations about the suitability of this 14# software for any purpose. It is provided "as is" without express or 15# implied warranty. 16#------------------------------------------------------------------------------ 17# $Id: fmath.tcl,v 1.2 2002/04/02 03:00:14 hobbs Exp $ 18#------------------------------------------------------------------------------ 19 20#@package: TclX-fmath acos asin atan ceil cos cosh exp fabs floor log log10 \ 21 sin sinh sqrt tan tanh fmod pow atan2 abs double int round 22 23proc acos x {uplevel 1 [list expr acos($x)]} 24proc asin x {uplevel 1 [list expr asin($x)]} 25proc atan x {uplevel 1 [list expr atan($x)]} 26proc ceil x {uplevel 1 [list expr ceil($x)]} 27proc cos x {uplevel 1 [list expr cos($x)]} 28proc cosh x {uplevel 1 [list expr cosh($x)]} 29proc exp x {uplevel 1 [list expr exp($x)]} 30proc fabs x {uplevel 1 [list expr abs($x)]} 31proc floor x {uplevel 1 [list expr floor($x)]} 32proc log x {uplevel 1 [list expr log($x)]} 33proc log10 x {uplevel 1 [list expr log10($x)]} 34proc sin x {uplevel 1 [list expr sin($x)]} 35proc sinh x {uplevel 1 [list expr sinh($x)]} 36proc sqrt x {uplevel 1 [list expr sqrt($x)]} 37proc tan x {uplevel 1 [list expr tan($x)]} 38proc tanh x {uplevel 1 [list expr tanh($x)]} 39 40proc fmod {x n} {uplevel 1 [list expr fmod($x,$n)]} 41proc pow {x n} {uplevel 1 [list expr pow($x,$n)]} 42 43# New functions that TclX did not provide in eariler versions. 44 45proc atan2 x {uplevel 1 [list expr atan2($x)]} 46proc abs x {uplevel 1 [list expr abs($x)]} 47proc double x {uplevel 1 [list expr double($x)]} 48proc int x {uplevel 1 [list expr int($x)]} 49proc round x {uplevel 1 [list expr round($x)]} 50 51 52 53