@@ -3953,8 +3953,18 @@ _mpd_get_exp_iterations(const mpd_t *r, mpd_ssize_t p)
39533953}
39543954
39553955/*
3956- * Internal function, specials have been dealt with. The result has a
3957- * relative error of less than 0.5 * 10**(-ctx->prec).
3956+ * Internal function, specials have been dealt with. Apart from Overflow
3957+ * and Underflow, two cases must be considered for the error of the result:
3958+ *
3959+ * 1) abs(a) <= 9 * 10**(-prec-1) ==> result == 1
3960+ *
3961+ * Absolute error: abs(1 - e**x) < 10**(-prec)
3962+ * -------------------------------------------
3963+ *
3964+ * 2) abs(a) > 9 * 10**(-prec-1)
3965+ *
3966+ * Relative error: abs(result - e**x) < 0.5 * 10**(-prec) * e**x
3967+ * -------------------------------------------------------------
39583968 *
39593969 * The algorithm is from Hull&Abrham, Variable Precision Exponential Function,
39603970 * ACM Transactions on Mathematical Software, Vol. 12, No. 2, June 1986.
@@ -3998,9 +4008,9 @@ _mpd_qexp(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
39984008 *
39994009 * MAX-EMAX+1 < log10(e^(0.1*10*t)) <= log10(e^(r*10^t)) < adjexp(e^(r*10^t))+1
40004010 *
4001- * (2) -1 < r <= -0.1, so e^r <= e^-0.1. It t > MAX_T, underflow occurs:
4011+ * (2) -1 < r <= -0.1, so e^r <= e^-0.1. If t > MAX_T, underflow occurs:
40024012 *
4003- * adjexp(e^(r*10^t)) <= log10(e^(r*10^t)) <= log10(e^(-0.1*10^t) < MIN-ETINY
4013+ * adjexp(e^(r*10^t)) <= log10(e^(r*10^t)) <= log10(e^(-0.1*10^t)) < MIN-ETINY
40044014 */
40054015#if defined(CONFIG_64 )
40064016 #define MPD_EXP_MAX_T 19
0 commit comments