-
Notifications
You must be signed in to change notification settings - Fork 480
Try module for scaling constants #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try module for scaling constants #501
Conversation
Codecov Report
@@ Coverage Diff @@
## master #501 +/- ##
=======================================
Coverage 83.33% 83.33%
=======================================
Files 1820 1820
Lines 170857 170857
=======================================
Hits 142384 142384
Misses 28473 28473
Continue to review full report at Codecov.
|
|
I made a PR against your branch. Also, at some point it may be nice to have an explicit quad precision, for the record I put it here: ! Standard constants for
integer, parameter :: qp = selected_real_kind(p=33)
real(qp), parameter :: qzero = 0.0_qp
real(qp), parameter :: qhalf = 0.5_qp
real(qp), parameter :: qone = 1.0_qp
real(qp), parameter :: qtwo = 2.0_qp
real(qp), parameter :: qthree = 3.0_qp
real(qp), parameter :: qfour = 4.0_qp
real(qp), parameter :: qeight = 8.0_qp
real(qp), parameter :: qten = 10.0_qp
complex(qp), parameter :: uzero = ( 0.0_qp, 0.0_qp )
complex(qp), parameter :: uhalf = ( 0.5_qp, 0.0_qp )
complex(qp), parameter :: uone = ( 1.0_qp, 0.0_qp )
character*1, parameter :: qprefix = 'Q'
character*1, parameter :: uprefix = 'U'
! Scaling constants
real(qp), parameter :: qulp = epsilon(0._qp)
real(qp), parameter :: qeps = qulp * 0.5_qp
real(qp), parameter :: qsafmin = real(radix(0._qp),qp)**max( &
minexponent(0._qp)-1, &
1-maxexponent(0._qp) &
)
real(qp), parameter :: qsafmax = qone / qsafmin
real(qp), parameter :: qsmlnum = qsafmin / qulp
real(qp), parameter :: qbignum = qsafmax * qulp
real(qp), parameter :: qrtmin = sqrt(qsmlnum)
real(qp), parameter :: qrtmax = sqrt(qbignum)
! Blue's scaling constants
real(qp), parameter :: qtsml = real(radix(0._qp), qp)**ceiling( &
(minexponent(0._qp) - 1) * 0.5_qp)
real(qp), parameter :: qtbig = real(radix(0._qp), qp)**floor( &
(maxexponent(0._qp) - digits(0._qp) + 1) * 0.5_qp)
! ssml = 1/s, where s was defined in https://doi.org/10.1145/355769.355771
real(qp), parameter :: qssml = real(radix(0._qp), qp)**( - floor( &
(minexponent(0._qp) - 1) * 0.5_qp))
! ssml = 1/S, where S was defined in https://doi.org/10.1145/355769.355771
real(qp), parameter :: qsbig = real(radix(0._qp), qp)**( - ceiling( &
(maxexponent(0._qp) - digits(0._qp) + 1) * 0.5_qp))however, note that compilers/architectures which doesn't support this will error out at compile time. So probably not the best to put in... :( |
I don't see your PR. In any case, I shall mention (and you've probably already noticed) that I used integer, parameter :: sp = kind(1.e0)and integer, parameter :: dp = kind(1.d0)instead of the Notice that the flags we mentioned do not work with Lapack. |
|
See here weslleyspereira#1 |
…/zerothi/lapack into try-module-for-scaling-constants
|
Looks good to me! |
|
For the record I files a bug report with gcc about the inconsistent handling of the From 10.3 onwards (fix merged!) one should be able to compile without promoting everything to quad precision, i.e. having a double-quad library. See here. EDIT: bug fixed in gcc! |
…le-for-scaling-constants Try module for scaling constants
This PR adds a module for scaling constants proposed by https://doi.org/10.1145/3061665. It was modified following the discussion in #496.
from the
CMakeLists.txt. The compiler now determines the Fortran layout by the file extension.