Aha! I read calculate.js more carefully and found that option (1) from my
previous post works if you just add the constant name (in upper- and
lower-case for convenience) to noconst:

  // chop out variables
  var noconst =
t.replace(/\b(PI|E|LOG2E|LOG10E|LN2|LN10|SQRT2|SQRT1_2|pi|phi|PHI)\b/g,
"_");

Apologies for pointless traffic...

Dave

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Golding
Sent: 19 May 2004 19:45
To: [EMAIL PROTECTED]
Subject: [DQSD-Users] adding mathematical constants


Hi all,

I'd like to add new mathematical constants to DQSD so I can (for example)
involve the golden ratio in a calculation by typing something like:

        350*phi

I tried four approaches - resulting in three failures and one near-success:

(1) Appending the following to calculate.js didn't work:

        phi = 1.618033988749894;

(2) Forcing the calculation in calculate.js didn't work either
(unsuprisingly):

        phi = (Math.sqrt(5)+1)/2;

(3) Appending the following to calcmem.txt didn't work:

        phi     number  1.618033988749894

(4) But appending a *single* character constant to calcmem.txt works:

        p       number  1.61803399

I wonder if I might be missing something obvious. Is it possible to have
(easily) customisable multicharacter constants? 

Thanks in advance,

Dave.







-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for
SourceForge Broadband and get the fastest 6.0/768 connection for only
$19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
To unsubscribe visit:
https://lists.sourceforge.net/lists/listinfo/dqsd-users
[EMAIL PROTECTED]
http://sourceforge.net/mailarchive/forum.php?forum_id=8601



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
To unsubscribe visit:
https://lists.sourceforge.net/lists/listinfo/dqsd-users
[EMAIL PROTECTED]
http://sourceforge.net/mailarchive/forum.php?forum_id†01

Reply via email to