LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ sroundup_lwork()

real function sroundup_lwork ( integer  LWORK)

SROUNDUP_LWORK

Purpose:
 SROUNDUP_LWORK deals with a subtle bug with returning LWORK as a Float.
 This routine guarantees it is rounded up instead of down by
 multiplying LWORK by 1+eps when it is necessary, where eps is the relative machine precision.
 E.g.,

        float( 16777217            ) == 16777216
        float( 16777217 ) * (1.+eps) == 16777218

 \return SROUNDUP_LWORK
 \verbatim
         SROUNDUP_LWORK >= LWORK.
         SROUNDUP_LWORK is guaranteed to have zero decimal part.
Parameters
[in]LWORKWorkspace size.
Author
Weslley Pereira, University of Colorado Denver, USA
Further Details:
  This routine was inspired in the method `magma_zmake_lwork` from MAGMA.
  \see https://bitbucket.org/icl/magma/src/master/control/magma_zauxiliary.cpp

Definition at line 58 of file sroundup_lwork.f.

59 *
60 * -- LAPACK auxiliary routine --
61 * -- LAPACK is a software package provided by Univ. of Tennessee, --
62 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
63 *
64 * .. Scalar Arguments ..
65  INTEGER LWORK
66 * ..
67 *
68 * =====================================================================
69 * ..
70 * .. Intrinsic Functions ..
71  INTRINSIC epsilon, real, int
72 * ..
73 * .. Executable Statements ..
74 * ..
75  sroundup_lwork = real( lwork )
76 *
77  IF( int( sroundup_lwork ) .LT. lwork ) THEN
78 * Force round up of LWORK
79  sroundup_lwork = sroundup_lwork * ( 1.0e+0 + epsilon(0.0e+0) )
80  ENDIF
81 *
82  RETURN
83 *
84 * End of SROUNDUP_LWORK
85 *
real function sroundup_lwork(LWORK)
SROUNDUP_LWORK