[PATCH] D29346: Fix APFloat mod
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 00:46:42 PDT 2017
skatkov added a comment.
This patch causes incorrect functional behavior, specifically, IEEE specification requires the sign of the remainder is the same as numerator in case remainder is zero.
It is incorrect with this patch. The following tests can be used to show the issue:
{
APFloat f1(APFloat::IEEEdouble(), "-4.0");
APFloat f2(APFloat::IEEEdouble(), "-2.0");
APFloat expected(APFloat::IEEEdouble(), "-0.0");
EXPECT_EQ(f1.mod(f2), APFloat::opOK);
EXPECT_TRUE(f1.bitwiseIsEqual(expected));
}
{
APFloat f1(APFloat::IEEEdouble(), "-4.0");
APFloat f2(APFloat::IEEEdouble(), "2.0");
APFloat expected(APFloat::IEEEdouble(), "-0.0");
EXPECT_EQ(f1.mod(f2), APFloat::opOK);
EXPECT_TRUE(f1.bitwiseIsEqual(expected));
}
I plan to revert this patch and add mentioned tests...
Repository:
rL LLVM
https://reviews.llvm.org/D29346
More information about the llvm-commits
mailing list