aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/APFloat.h
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-08-31 04:03:46 +0000
committerDale Johannesen <dalej@apple.com>2007-08-31 04:03:46 +0000
commiteaf089430e7681fcddc3465c3b33b9645273ab02 (patch)
tree426df38ac585285c3b18e3b4575b297fcd4d9e59 /include/llvm/ADT/APFloat.h
parent8c132633c86a7e496f84e3458c47520d0cc4d938 (diff)
downloadexternal_llvm-eaf089430e7681fcddc3465c3b33b9645273ab02.zip
external_llvm-eaf089430e7681fcddc3465c3b33b9645273ab02.tar.gz
external_llvm-eaf089430e7681fcddc3465c3b33b9645273ab02.tar.bz2
Enhance APFloat to retain bits of NaNs (fixes oggenc).
Use APFloat interfaces for more references, mostly of ConstantFPSDNode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/APFloat.h')
-rw-r--r--include/llvm/ADT/APFloat.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/llvm/ADT/APFloat.h b/include/llvm/ADT/APFloat.h
index 165e290..a29f15c 100644
--- a/include/llvm/ADT/APFloat.h
+++ b/include/llvm/ADT/APFloat.h
@@ -64,8 +64,11 @@
so that the smallest denormal has just the least significant bit
of the significand set. The sign of zeroes and infinities is
significant; the exponent and significand of such numbers is
- indeterminate and meaningless. For QNaNs the sign bit, as well as
- the exponent and significand are indeterminate and meaningless.
+ not stored, but has a known implicit (deterministic) value:
+ 0 for the significands, 0 for zero exponent, all 1 bits for
+ infinity exponent. For NaNs the sign and significand are
+ deterministic, although not really meaningful; the exponent is
+ implicitly all 1 bits.
TODO
====
@@ -155,7 +158,7 @@ namespace llvm {
/* Category of internally-represented number. */
enum fltCategory {
fcInfinity,
- fcQNaN,
+ fcNaN,
fcNormal,
fcZero
};
@@ -192,7 +195,7 @@ namespace llvm {
whatever it is you really mean. */
// bool operator==(const APFloat &) const; // DO NOT IMPLEMENT
- /* IEEE comparison with another floating point number (QNaNs
+ /* IEEE comparison with another floating point number (NaNs
compare unordered, 0==-0). */
cmpResult compare(const APFloat &) const;
@@ -205,6 +208,8 @@ namespace llvm {
bool isZero() const { return category == fcZero; }
bool isNonZero() const { return category != fcZero; }
bool isNegative() const { return sign; }
+ bool isPosZero() const { return isZero() && !isNegative(); }
+ bool isNegZero() const { return isZero() && isNegative(); }
APFloat& operator=(const APFloat &);