atan provides a handy way to ask Tcl for the value of pi:
% expr {atan(1) * 4} 3.1415926535897931
MGS Actually, using acos() is (slightly) more efficient:
% set tcl_precision 17 17 % expr {acos(-1)} 3.1415926535897931
Does anyone have any data on which method is preferable from a numerical point of view?
IDG Both contain the assumption that the transcendental functions are accurate to the last ulp. In many math libraries this is not so. I think you are safer with a string representation:
set pi 3.1415926535897931
Math function help - Arts and Crafts of Tcl-Tk Programming - Category Mathematics