- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it reasonable to assume most modern compilers will see float**2 and replace it with float*float? I'm trying to improve the readability of someone else's code, without sacrificing performance, although I'm sure it's been quite some time since the code has been profiled on current hardware.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
just to clarify, the actual variable is a multidimensional array with a longer name, and is being indexed/sliced, so typing the equivalent of float*float is much longer than typing the exponentiation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, all high quallty Fortran compilers I've seen in the last decade are expanding and optimizing **2 (some will do it even with the decimal point implying a real data type exponent).
You could try a limited test, simply assure that no exponentiation function call is introduced when you run nm on the .o file.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page