From 1cb50e0343b35cf34938c80122d633ec2cf68494 Mon Sep 17 00:00:00 2001 From: Mantas Mikaitis Date: Tue, 30 Apr 2024 08:58:35 +0100 Subject: [PATCH] Addressed comments on PR #4 --- src/cpfloat_definitions.h | 12 ++++++------ src/cpfloat_template.h | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cpfloat_definitions.h b/src/cpfloat_definitions.h index ab9e94e..78bfc7b 100644 --- a/src/cpfloat_definitions.h +++ b/src/cpfloat_definitions.h @@ -193,9 +193,9 @@ typedef struct { * @brief Maximum exponent of target format. * * @details The maximum values allowed are 127 and 1023 if the storage format - * is `float` or `double`, respectively. Larger values are reduced to the - * maximum allowed value without warning. This field is ignored unless - * `explim` is set to `CPFLOAT_EXPRANGE_TARG`. + * is `float` or `double`, respectively. If a larger value is chosen, it is + * changed to the maximum allowed value without warning. This field is ignored + * unless `explim` is set to `CPFLOAT_EXPRANGE_TARG`. * * The validation functions cpfloatf_validate_optstruct() and * cpfloat_validate_optstruct() return an error code if the required maximum @@ -206,9 +206,9 @@ typedef struct { * @brief Minimum exponent of target format. * * @details The minimum values allowed are -126 and -1022 if the storage format - * is `float` or `double`, respectively. Smaller values are increase to the - * minimum allowed value without warning. This field is ignored unless - * `explim` is set to `CPFLOAT_EXPRANGE_TARG`. + * is `float` or `double`, respectively. If a smaller value is chosen, it is + * changed to the minimum allowed value without warning. This field is ignored + * unless `explim` is set to `CPFLOAT_EXPRANGE_TARG`. * * The validation functions cpfloatf_validate_optstruct() and * cpfloat_validate_optstruct() return an error code if the required minimum diff --git a/src/cpfloat_template.h b/src/cpfloat_template.h index 1e85ae4..1ee1744 100644 --- a/src/cpfloat_template.h +++ b/src/cpfloat_template.h @@ -106,7 +106,7 @@ optstruct *init_optstruct() { fpopts->bitseed = NULL; fpopts->randseedf = NULL; fpopts->randseed = NULL; - fpopts->emin = -99999; + fpopts->emin = 0; return fpopts; } @@ -283,7 +283,7 @@ static inline int VALIDATE_INPUT(const optstruct *fpopts) { /* Return -6 if emin is invalid (either nonnegative or too small). */ if (fpopts->emin < DEFEMIN || fpopts->emin >= 0) return -6; - + /* Return 0 or warning value. */ return retval; } @@ -310,8 +310,8 @@ static inline FPPARAMS COMPUTE_GLOBAL_PARAMS(const optstruct *fpopts, /* Derived floating point parameters. */ int emin = fpopts->emin; - /* If emin is not set by user, set it to the default 1-emax. */ - if (emin == -99999) + /* If emin is not set by the user, set it to the default 1-emax. */ + if (emin == 0) emin = 1-emax; if (emin < DEFEMIN) { emax = DEFEMIN;