| Re: Physical constants in IDL with !CONST [message #82576 is a reply to message #82525] |
Thu, 20 December 2012 12:31   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hello,
On 12/20/12 14:10, Chris Torrence wrote:
> On Thursday, December 20, 2012 10:36:21 AM UTC-7, Heinz Stege wrote:
>
> Hi Heinz,
>
> That's a really good point. I had the same dilemma about "eV" when I
> put it in. I like your idea of getting rid of "e".
For what it's worth, I agree with Heinz. But for a (slightly) different
reason.
The symbol for elementary charge on the NIST site is "e". Thus that
should be what is used in !C.
Consistent adherence to a convention (in this case: all this stuff comes
from the NIST/CODATA site) is A Good Thing (tm).
> Also, yes, I'll make the "DtoR" and "RtoD" consistent. Maybe "DegRad"
> and "RadDeg", so at least they are somewhat human-readable?
I prefer the former to the latter simply because of the preposition "to"
indicating a direction of conversion.
<aside mode="tangential">
I've never been a big fan of making constant names short because people
want to save some keystrokes. In fact, that violates most
advice/conventions on naming in the usual texts ("Code Complete", "Clean
Code", etc etc)
I'm a verbose sort so the following is what I use:
REAL(fp), PARAMETER :: PI = 3.141592653589793238462643383279_fp
REAL(fp), PARAMETER :: TWOPI = TWO * PI
REAL(fp), PARAMETER :: DEGREES_TO_RADIANS = PI / 180.0_fp
REAL(fp), PARAMETER :: RADIANS_TO_DEGREES = 180.0_fp / PI
(I have similar in IDL code so I'm sure of the precision)
So if it's human readability you want, why not DEGREES_TO_RADIANS and
RADIANS_TO_DEGREES?
I realise just about everyone will disagree with me.
And that's o.k. :o)
</aside>
cheers,
paulv
|
|
|
|