提交 defcc940 编写于 作者: M Matt Pharr

FastExp(): make sure that FastExp(0) == 1

上级 422fbe9f
......@@ -411,7 +411,7 @@ inline float FastExp(float x) {
int i = (int)fxp;
// Evaluate polynomial approximation of $2^f$
float twoToF = EvaluatePolynomial(f, 0.999813f, 0.696834f, 0.224131f, 0.0790209f);
float twoToF = EvaluatePolynomial(f, 1.f, 0.695556856f, 0.226173572f, 0.0781455737f);
// Scale $2^f$ by $2^i$ and return final result
int exponent = Exponent(twoToF) + i;
......
......@@ -283,6 +283,8 @@ TEST(Math, SumOfProducts) {
}
TEST(FastExp, Accuracy) {
EXPECT_EQ(1, FastExp(0));
Float maxErr = 0;
RNG rng(6502);
for (int i = 0; i < 100; ++i) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册