// Test special cases for(int i = 0; i < testCases.length; i++) {
failures += testLog1pCaseWithUlpDiff(testCases[i][0],
testCases[i][1], 0);
}
// For |x| < 2^-54 log1p(x) ~= x for(int i = DoubleConsts.MIN_SUB_EXPONENT; i <= -54; i++) { double d = Math.scalb(2, i);
failures += testLog1pCase(d, d);
failures += testLog1pCase(-d, -d);
}
// For x > 2^53 log1p(x) ~= log(x) for(int i = 53; i <= Double.MAX_EXPONENT; i++) { double d = Math.scalb(2, i);
failures += testLog1pCaseWithUlpDiff(d, StrictMath.log(d), 2.001);
}
// Construct random values with exponents ranging from -53 to // 52 and compare against HP-15C formula.
java.util.Random rand = RandomFactory.getRandom(); for(int i = 0; i < 1000; i++) { double d = rand.nextDouble();
// Test for monotonicity failures near values y-1 where y ~= // e^x. Test two numbers before and two numbers after each // chosen value; i.e. // // pcNeighbors[] = // {nextDown(nextDown(pc)), // nextDown(pc), // pc, // nextUp(pc), // nextUp(nextUp(pc))} // // and we test that log1p(pcNeighbors[i]) <= log1p(pcNeighbors[i+1])
{ double pcNeighbors[] = newdouble[5]; double pcNeighborsLog1p[] = newdouble[5]; double pcNeighborsStrictLog1p[] = newdouble[5];
for(int i = -36; i <= 36; i++) { double pc = StrictMath.pow(Math.E, i) - 1;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:
(vorverarbeitet am 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.