HP Forums

Full Version: [WP34s] More constants than CONST offers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Looking at the 34s assembler documentation is seems there are more constants available than listed in the CONST menu. For instance pi/2, ln 2 or – very useful not only for the statistical distributions – sqrt(2 pi). Is there a special reason why these constants are hidden from the user and not directly accessible?

Dieter
Oh come on, you want to use your calculator, don't you? I voted against including 1/2 and Φ into CONST since they are trivial to calculate - well, not everybody knows Φ. But it will take you longer to recall ln(2) from CONST than to calculate it ... (man soll's ja auch nicht übertreiben).

d:-/
(05-26-2014 08:51 PM)walter b Wrote: [ -> ]Oh come on, you want to use your calculator, don't you?

Yes. For instance for programming. And this can be done much more conveniently and elegantly with these additional constants. And they do not affect the stack and LastX either.

Quote:I voted against including 1/2 and Φ into CONST since they are trivial to calculate

Take a look at the quantile code I just posted. Did you count the number of "1/2" commands? This simple constant makes things so much easier. Before it was included I suggested a different version for the Normal quantile where 1/2 was even stored in a separate register so that it could be recalled from there whenever it was required.

There also is another point: calculated results are not neccessarily exact. Take pi/2: both in SP and DP the result is 1 ULP off.

So once again: why have these constants not been included in CONST while they are available in the assembler (and obviously get assembled to a valid opcode).

Dieter
I don't remember that we really ever seriously considered the inclusion of these internal constants in the catalogue.

Not all are relevant or usefully exposed, but some might be:
• 1/sqrt(5)
• 1/sqrt(pi)
• sqrt(2 pi)
• pi / 2
• ln(2)
• 1/ln(2)
• 1/ln(10)
• 1/eH
• 1/eL perhaps

There would be a (small) space cost for exposing each additional constant.

- Pauli
(05-26-2014 11:32 PM)Paul Dale Wrote: [ -> ]Not all are relevant or usefully exposed, but some might be:

Is this a complete, comprehensive list of all available constants not included in the CONST menu? A few of these would really make sense, for instance multiples of pi like pi/2, pi/4, 2pi and, as already mentioned, sqrt(2pi).

Walter said he does not like constants that can easily be obtained from others. Great – this way we can get rid of a lot of physical constants. Take for instance h and ħ (which is simply h divided by 2 pi) or Φ0 which is nothing but 1/Kj and therefore as useful has having a separate 1/pi constant (which would even have the benefit of slightly better accuracy). Removing redundancies like these will free up space for universally useful constants like the ones suggested.

Hey, I just found a way how to use the additional constants with current firmware: simply use the CNST command. This is what I got:

Code:
```CNST 77 = 1/eH (higher 34 digits of 1/e, as used in Lambert's W) CNST 78 = 1/eL (lower 34 digits of 1/e, as used in Lambert's W) CNST 79 = 1/√5 CNST 80 = 1/√pi CNST 81 = 0,2214  (currently used in the Chi² quantile, will be obsolete with the suggested new quantile code) CNST 82 = 1/ln10 CNST 83 = ln 2 CNST 84 = 1/ln2 CNST 85 = pi CNST 86 = pi/2 CNST 87 = √2pi CNST 88 = 122,134  (counter/pointer used in Romberg integration)```

So at least these constants can be used in user programs. Readability is another point...

Dieter
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :