While c and h are unlikely to change, the precision that you need in your 
program could change, and it is much easier to edit a single value in the 
constant declaration than to edit each line of code that refers to some 
approximation.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Paul Gilmartin <0000000433f07816-dmarc-requ...@listserv.ua.edu>
Sent: Friday, September 4, 2020 5:37 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Constant Identifiers

On Fri, 4 Sep 2020 17:04:34 +0000, Seymour J Metz wrote:

>Do you have a URL and page number? Is that an exact quote, or was there a 
>conditional?
>
I cited the Language Ref.

>It is good form to use a constant that stands for itself, e.g., "X**2". It is 
>bad form to use a constant for, e.g., an approximation, an empirical value, a 
>value subject to regulatory change. The general rule is to avoid "magic 
>numbers". Thus, things like PI, E, MAX_INTEREST_RATE should have names.
>
Pi will always necessarily be an approximation.  c and h are exact
(for over a year now) and are extremely unlikely ever to change.
(But they may not be exactly represented in HFP or BFP.)
    
https://secure-web.cisco.com/1NC67NF5kM5VnHYzGAF2Zq-Tn8mTOfe4CqNxt6KxlAT3LspG6wPmczEICeIMWytVPzXIKlJXOo1nRm101zICZn9_dvnHCd_Q3XSiy4y6_enSQ9UbIjwT4tLTQAyjmqSI2-A7Wr_YkRZZh3OkV0Fq6sWwMr5Q8pYh-bFO9u7gchBlv13lr-iLjuHquewaTZl-bGUYdrCxhID02MTNWdOJ4xy_p7rdzPFpON5IENXMFlHVBlwXgCKVGtB4JYiXQjOLvIN8rxzjQGVIun1Asx5E1Jzg3xDfEu8nGFeLLQmjsaOmMuJ3YNkS6eDEcT1J8rBZacxTfgm04gTsQ8MgP9YnA8OdPKu1jqBgO6DnKFE2PlWfU3AfTTLLeuuoLkHhjl6WpgrbXlUDBdxs2YlIhTrPGj7kYgIFc6RlUAoJ0unRY3KuryJUJ20QsW2HQDn9sVlQc/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FInternational_System_of_Units#Base_units

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to