Skip to content

Commit 534a88d

Browse files
committed
Define log(2.0) as a constant.
1 parent 34745cb commit 534a88d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/stdlib_constants.fypp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ module stdlib_constants
7171
#:for k, t, s in R_KINDS_TYPES
7272
${t}$, parameter, public :: zero_${s}$ = 0._${k}$
7373
${t}$, parameter, public :: one_${s}$ = 1._${k}$
74+
${t}$, parameter, public :: log2_${s}$ = log(2.0_${k}$)
7475
#:endfor
7576
#:for k, t, s in C_KINDS_TYPES
7677
${t}$, parameter, public :: zero_${s}$ = (0._${k}$,0._${k}$)

src/stdlib_linalg_matrix_functions.fypp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ contains
3030
real(${rk}$) :: a_norm, c
3131
integer(ilp) :: m, n, ee, k, s, order_, i, j
3232
logical(lk) :: p
33-
character(len=*), parameter :: this = "expm"
3433
type(linalg_state_type) :: err0
3534

3635
! Deal with optional args.
@@ -54,7 +53,7 @@ contains
5453
a_norm = mnorm(A, "inf")
5554

5655
! Determine scaling factor for the matrix.
57-
ee = int(log(a_norm) / log(2.0_${rk}$)) + 1
56+
ee = int(log(a_norm) / log2_${rk}$) + 1
5857
s = max(0, ee+1)
5958

6059
! Scale the input matrix & initialize polynomial.

0 commit comments

Comments
 (0)