forked from mom-ocean/MOM6
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cuberoot: Refactor (re|de)scale functions
Some modifications were made to the cuberoot rescale and descale functions: * The machine parameters were moved from function to module parameters. This could dangerously expose them to other functions, but it prevents multiple definitions of the same numbers. * The exponent is now cube-roote in rescale rather than descale, and the fact that the rescaled exponent is always -1 is now integrated into the expressions, rather than read and appended to the old value. * The exponent expressions are broken into more explicit steps, rather than combining multiple steps and assumptions into a single expression. We are counting on the compiler to simplify these! * The bias is no longer assumed to be a multiple of three! This is true for double precision but not single precision. * The bias is removed (and later restored) to the exponent terms before computing the new exponents after cuberoot. Although this reduces the number of bit-reading operations by one, I did not see any appreciable change in performance. We probably have more work to do than simple tweaks to bit operations. A new test of quasi-random number was also added to the cuberoot test suite. These numbers were able to detect the differences in GNU and Intel compiler output. Co-authored-by: Robert Hallberg <Robert.Hallberg@noaa.gov>
- Loading branch information
1 parent
fea9103
commit 933388f
Showing
1 changed file
with
62 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters