A function in the [expr] command that computes the '''tangent''' of an angle. The angle is expressed in radians. ---- 2007-11-01 Harm Olthof: I was just wondering how to get [tan] return +/-[Inf] (and what choice it would make for the sign). 59 % expr tan(acos(0)) 16331778728383844.0 60 % expr tan(acos(0.0)) 16331778728383844.0 61 % set pi 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068 62 % expr tan(double($pi/2.0)) 16331778728383844.0 [DGP] Somewhat more direct demonstration of the same thing: % expr tan(atan(Inf)) 16331778728383844.0 The arctan of infinity should be pi/2 radians. However, the value pi/2 is transcendental, with no accurate representation in a finite number of digits. Computers by their nature represent numbers with only a finite number of digits, so atan(Inf) returns the best approximation it can: % expr atan(Inf) 1.5707963267948966 Taking the tangent of that value which is near, but not exactly pi/2, yields an answer which is large, but not Inf. This is all a natural expected consequence of the limited precision of floating point number representations in computers. It is not particular to Tcl. Calling the equivalent C functions shows the same thing. ---- !!!!!! %| [Category Mathematics] |% !!!!!!