From 51eee01d77b9be9117080e2460af9121bf239efd Mon Sep 17 00:00:00 2001 From: "weslley.spereira" Date: Wed, 4 Aug 2021 18:17:28 -0300 Subject: [PATCH] Improve documentation of the new routines. Force roundup only if it is necessary --- INSTALL/droundup_lwork.f | 16 ++++++++++------ INSTALL/sroundup_lwork.f | 15 ++++++++------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/INSTALL/droundup_lwork.f b/INSTALL/droundup_lwork.f index 631d782086..86f84b2ad3 100644 --- a/INSTALL/droundup_lwork.f +++ b/INSTALL/droundup_lwork.f @@ -21,13 +21,17 @@ *> \verbatim *> *> DROUNDUP_LWORK deals with a subtle bug with returning LWORK as a Float. -*> If LWORK > 2**24, then it will get rounded as a Float. *> This routine guarantees it is rounded up instead of down by -*> multiplying LWORK by 1+eps, where eps is the relative machine precision. +*> multiplying LWORK by 1+eps when it is necessary, where eps is the relative machine precision. +*> E.g., +*> +*> float( 9007199254740993 ) == 9007199254740992 +*> float( 9007199254740993 ) * (1.+eps) == 9007199254740994 *> *> \return DROUNDUP_LWORK *> \verbatim *> DROUNDUP_LWORK >= LWORK. +*> DROUNDUP_LWORK is guaranteed to have zero decimal part. *> \endverbatim * * Arguments: @@ -64,14 +68,14 @@ DOUBLE PRECISION FUNCTION DROUNDUP_LWORK( LWORK ) * ===================================================================== * .. * .. Intrinsic Functions .. - INTRINSIC DIGITS, RADIX, EPSILON + INTRINSIC EPSILON, DBLE, INT * .. * .. Executable Statements .. * .. - DROUNDUP_LWORK = LWORK + DROUNDUP_LWORK = DBLE( LWORK ) * - IF( DROUNDUP_LWORK .GE. DBLE(RADIX(0.0D+0))**DIGITS(0.0D+0) ) THEN -* If LWORK can't be represented exactly in double precision + IF( INT( DROUNDUP_LWORK ) .LT. LWORK ) THEN +* Force round up of LWORK DROUNDUP_LWORK = DROUNDUP_LWORK * ( 1.0D+0 + EPSILON(0.0D+0) ) ENDIF * diff --git a/INSTALL/sroundup_lwork.f b/INSTALL/sroundup_lwork.f index 2ba68077c1..7fe8610f05 100644 --- a/INSTALL/sroundup_lwork.f +++ b/INSTALL/sroundup_lwork.f @@ -21,16 +21,17 @@ *> \verbatim *> *> SROUNDUP_LWORK deals with a subtle bug with returning LWORK as a Float. -*> If LWORK > 2**24, then it will get rounded as a Float. *> This routine guarantees it is rounded up instead of down by -*> multiplying LWORK by 1+eps, where eps is the relative machine precision. +*> 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 +*> float( 16777217 ) * (1.+eps) == 16777218 *> *> \return SROUNDUP_LWORK *> \verbatim *> SROUNDUP_LWORK >= LWORK. +*> SROUNDUP_LWORK is guaranteed to have zero decimal part. *> \endverbatim * * Arguments: @@ -67,14 +68,14 @@ REAL FUNCTION SROUNDUP_LWORK( LWORK ) * ===================================================================== * .. * .. Intrinsic Functions .. - INTRINSIC DIGITS, RADIX, EPSILON + INTRINSIC EPSILON, REAL, INT * .. * .. Executable Statements .. * .. - SROUNDUP_LWORK = LWORK + SROUNDUP_LWORK = REAL( LWORK ) * - IF( SROUNDUP_LWORK .GE. REAL(RADIX(0.0E+0))**DIGITS(0.0E+0) ) THEN -* If LWORK can't be represented exactly in single precision + IF( INT( SROUNDUP_LWORK ) .LT. LWORK ) THEN +* Force round up of LWORK SROUNDUP_LWORK = SROUNDUP_LWORK * ( 1.0E+0 + EPSILON(0.0E+0) ) ENDIF *