Don't most compilers these days do constant folding?
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List <[email protected]> on behalf of Bob Bridges <[email protected]> Sent: Saturday, September 5, 2020 4:18 PM To: [email protected] Subject: Re: Constant Identifiers When you care about efficiency, I'd think this would be better: const=4/3*3.14159E0 /* in the initialization */ volume=const*radius**3 /* inside the loop */ --- Bob Bridges, [email protected], cell 336 382-7313 /* Things may come to those who wait, but only those things left behind by those who hustle. -attributed (probably falsely) to Abraham Lincoln, lawyer */ -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Robin Vowels Sent: Friday, September 4, 2020 18:14 As for writing formulas, I prefer to follow a well-known formula, thus: volume = 4/3 * 3.14159 * radius**3 However, if I'm interested in efficiency, I'd prefer volume = 4 * 3.14159E0 / 3 * radius**3 ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
