/// getNaN - Factory for QNaN values.
///
- /// \param Negative - True iff the NaN generated should be negative.
+ /// \param Negative - True if the NaN generated should be negative.
/// \param type - The unspecified fill bits for creating the NaN, 0 by
/// default. The value is truncated as necessary.
static APFloat getNaN(const fltSemantics &Sem, bool Negative = false,
/// getLargest - Returns the largest finite number in the given
/// semantics.
///
- /// \param Negative - True iff the number should be negative
+ /// \param Negative - True if the number should be negative
static APFloat getLargest(const fltSemantics &Sem, bool Negative = false);
/// getSmallest - Returns the smallest (by magnitude) finite number
/// in the given semantics. Might be denormalized, which implies a
/// relative loss of precision.
///
- /// \param Negative - True iff the number should be negative
+ /// \param Negative - True if the number should be negative
static APFloat getSmallest(const fltSemantics &Sem, bool Negative = false);
/// getSmallestNormalized - Returns the smallest (by magnitude)
/// normalized finite number in the given semantics.
///
- /// \param Negative - True iff the number should be negative
+ /// \param Negative - True if the number should be negative
static APFloat getSmallestNormalized(const fltSemantics &Sem,
bool Negative = false);
/* C fmod, or llvm frem. */
opStatus mod(const APFloat &, roundingMode);
opStatus fusedMultiplyAdd(const APFloat &, const APFloat &, roundingMode);
+ opStatus roundToIntegral(roundingMode);
/* Sign operations. */
void changeSign();
const fltSemantics &getSemantics() const { return *semantics; }
bool isZero() const { return category == fcZero; }
bool isNonZero() const { return category != fcZero; }
+ bool isNormal() const { return category == fcNormal; }
bool isNaN() const { return category == fcNaN; }
bool isInfinity() const { return category == fcInfinity; }
bool isNegative() const { return sign; }
APFloat& operator=(const APFloat &);
- /* Return an arbitrary integer value usable for hashing. */
- uint32_t getHashValue() const;
+ /// \brief Overload to compute a hash code for an APFloat value.
+ ///
+ /// Note that the use of hash codes for floating point values is in general
+ /// frought with peril. Equality is hard to define for these values. For
+ /// example, should negative and positive zero hash to different codes? Are
+ /// they equal or not? This hash value implementation specifically
+ /// emphasizes producing different codes for different inputs in order to
+ /// be used in canonicalization and memoization. As such, equality is
+ /// bitwiseIsEqual, and 0 != -0.
+ friend hash_code hash_value(const APFloat &Arg);
/// Converts this value into a decimal string.
///