[PATCH] D111917: Print the sign of negative infinity
Logan Chien via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 14 22:40:09 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9eb71608ee0f: Print the sign of negative infinity (authored by logan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111917/new/
https://reviews.llvm.org/D111917
Files:
llvm/lib/Support/NativeFormatting.cpp
llvm/unittests/Support/NativeFormatTests.cpp
Index: llvm/unittests/Support/NativeFormatTests.cpp
===================================================================
--- llvm/unittests/Support/NativeFormatTests.cpp
+++ llvm/unittests/Support/NativeFormatTests.cpp
@@ -125,6 +125,8 @@
FloatStyle::Fixed));
EXPECT_EQ("INF", format_number(std::numeric_limits<double>::infinity(),
FloatStyle::Fixed));
+ EXPECT_EQ("-INF", format_number(-std::numeric_limits<double>::infinity(),
+ FloatStyle::Fixed));
}
TEST(NativeFormatTest, HexTests) {
Index: llvm/lib/Support/NativeFormatting.cpp
===================================================================
--- llvm/lib/Support/NativeFormatting.cpp
+++ llvm/lib/Support/NativeFormatting.cpp
@@ -168,7 +168,7 @@
S << "nan";
return;
} else if (std::isinf(N)) {
- S << "INF";
+ S << (std::signbit(N) ? "-INF" : "INF");
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111917.394468.patch
Type: text/x-patch
Size: 958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211215/48f45353/attachment.bin>
More information about the llvm-commits
mailing list