Limitation of function EXP()
#13
(02-23-2023, 02:57 PM)Jack Wrote:
(02-22-2023, 06:27 PM)SMcNeill Wrote:
Code: (Select All)
// EXP
double func_exp_single(double value) {
    if (value <= 88.02969) {
        return exp(value);
    }
    error(6);
    return 0;
}
long double func_exp_float(long double value) {
    if (value <= 709.782712893) {
        return exp(value);
    }
    error(6);
    return 0;
}

@SMcNeill

in this statement: if (value <= 709.782712893)
what if value is -11356 for example?
I think that it needs to be something like the following
Code: (Select All)
long double func_exp_float(long double value) {
    if (fabsl(value) <= 11355) {
        return exp(value);
    }
    error(6);
    return 0;
}
The limitation is with the definition of the maximum double 1.7976E+308

the maximum number = ln(1.7976E308)=709.78177061
Reply


Messages In This Thread
Limitation of function EXP() - by BSpinoza - 02-22-2023, 11:26 AM
RE: Limitation of function EXP() - by mnrvovrfc - 02-22-2023, 11:59 AM
RE: Limitation of function EXP() - by Jack - 02-22-2023, 12:22 PM
RE: Limitation of function EXP() - by Jack - 02-22-2023, 07:49 PM
RE: Limitation of function EXP() - by Sprezzo - 02-22-2023, 02:51 PM
RE: Limitation of function EXP() - by Kernelpanic - 02-22-2023, 06:25 PM
RE: Limitation of function EXP() - by SMcNeill - 02-22-2023, 06:27 PM
RE: Limitation of function EXP() - by Kernelpanic - 02-22-2023, 06:48 PM
RE: Limitation of function EXP() - by BSpinoza - 02-23-2023, 04:44 AM
RE: Limitation of function EXP() - by Jack - 02-23-2023, 10:27 AM
RE: Limitation of function EXP() - by RhoSigma - 02-23-2023, 11:46 AM
RE: Limitation of function EXP() - by Jack - 02-23-2023, 02:57 PM
RE: Limitation of function EXP() - by jcm - 02-23-2023, 03:08 PM
RE: Limitation of function EXP() - by RhoSigma - 02-23-2023, 06:02 PM



Users browsing this thread: 2 Guest(s)