Whereas the addition of new constants such as e, the golden ratio, etc. can
be benificial to xTalk programming;
Whereas the addition of new constants can -- and will -- conflict with
existing variable names; and
Whereas conflicts with existing variable names will produce errors or,
worse, incorrect results,
Be it proposed:
constant <name> [ = | as <value>]
as a way to declare that a handler or function uses a given constant. The
syntax is simular to global.
A constant given a value can have any name; it is for notational
conveniance. The value may be any expression resolving to what in C would
be known as an lvalue.
A constant without the value is to be looked up in a built-in table of
well-known constants. If the constant is not found in said table, the line
is in error. The following constants are "well known constants":
pi
e
i (this is going to open a can of worms...)
any others that we think of adding
The main two goals are to:
a) Allow the user to create symbolic names for numbers
b) Allow the addition of constants without breaking scripts.
NOTE: If a value is specified, the constant is not looked up in the
well-known table. Values specified overide any well-known value. This is to
avoid breaking scripts.
Here are some other constants that are availible off of project gutenberg.
If anyone thinks them worthwhile, please say so:
1-6/(Pi^2) sum(1/2^(2^n),n=0..infinity)
1/Pi 3/(Pi*Pi)
1/log(2) arctan(1/2)
1/sqrt(2*Pi) Artin's Constant
Backhouse constant Berstein Constant
Catalan evaluation cos(1)
Champernowne constant, the natural integers concatenated.
Copeland-Erdos constant, the primes concatenated.
3^(1/3) (exp(2)-7)/2
Zeta(1,2) ot the derivative of Zeta function at 2.
exp(1/e) Gompertz (1825) constan
exp(2) exp(E)
exp(-1)**exp(-1) exp(gamma)
exp(-exp(1)) exp(-gamma)
exp(-1) exp(Pi)
exp(-Pi/2) exp(Pi/4)
exp(Pi)-Pi exp(Pi)/Pi**E
Feigenbaum reduction parameter
Feigenbaum bifurcation velocity constant
Fransen-Robinson constant.
gamma or Euler constant GAMMA(1/3)
GAMMA(1/4) The Euler constant squared
GAMMA(2/3) gamma cubed
GAMMA(3/4) gamma**(exp(1)
2**sqrt(2) Gibbs Constant
Gauss-Kuzmin-Wirsing constant Golomb constant
Grothendieck's majorant 1/W(1)
Khinchin constant Landau-Ramanujan constant
The Lehmer constant Lemniscate constant or Gauss constant
Lengyel constant Levy constant
log(10) log10(2)
ln(2) log(2)^2
log(2*Pi) ln(3)
log(4)/log(3) -log(gamma)
|log(log(2))| 1/2*ln(1/2 + 1/2 5 )
ln(pi) Madelung constant
BesselI(1,2)/BesselI(0,2) omega constant
Parking or Renyi constant Pi/2*sqrt(3)
Smallest Pisot-Vijayaraghavan number
the Ramanujan number Robbins constant
Salem Constant Traveling Salesman Constant
Tribonacci constant twin primes constant
Varga constant Apery constant
Hard hexagons Entropy Constant
The 32nd Mersenne Prime (yeh... we're going to code that in there :)