Skip to content
Tcl Source Code View Ticket
Login

View Ticket

pi functions for [expr]

Closed1166838fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 20 years ago
Descriptionplain2005-03-20 06:41:41
Add to [expr] functions that: return the value of pi,
half pi,
2 pi; convert rad to deg and vice versa.

I find them useful to do [canvas] graphics. I know that one
can do [expr acos(0.0)] and process the value, but it does
no good to code readability.
vincentdarleyplain2005-04-01 15:57:30
Logged In: YES 
user_id=32170

For code readability, surely you can do 'set pi [expr
{2*acos(0.0)}]' and then use $pi in all your expressions?
marcomaggiplain2005-04-04 02:04:27
Logged In: YES 
user_id=727156

Using a variable is what I'm doing; but its annoying to expose
a global/module variable for this, and it's even more annoying
to compute the value each time.
dkf Ticket [1166838fff]: 1 change [History diff]2005-04-04 15:57:25
dkfplain2005-04-04 15:57:26
Logged In: YES 
user_id=79902

We don't have symbolic constants in the expression parser
currently (as opposed to literals) and the value of pi
shouldn't be the result of a function IMO.
marcomaggiplain2005-04-07 02:23:08
Logged In: YES 
user_id=727156

A function with argument is even better:
pim(value), "pi multiplied"; returns pi multiplied by "value":

pi(1) -> 3,14...
pi(2) ->  6.28...
pi(0.5) -> 1.57...

I understand that this is "strange", but I do not intend to
propose
a way to let known constants be obtained in an expressions;
I think that pi is important enough to have it, even with a
strange
function.
dgpplain2005-04-07 11:21:13
Logged In: YES 
user_id=80530

TIP 232 makes the pim() function
a trivial proc.
msofer Pending ticket [1166838fff]. [History diff]2006-09-30 00:58:56
sf-robotplain2006-10-14 09:20:07
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.