17 #ifndef LLVM_ADT_APFLOAT_H
18 #define LLVM_ADT_APFLOAT_H
214 Val.makeZero(Negative);
223 Val.makeInf(Negative);
235 APInt fill(64, type);
236 return getQNaN(Sem, Negative, &fill);
238 return getQNaN(Sem, Negative, 0);
244 const APInt *payload = 0) {
245 return makeNaN(Sem,
false, Negative, payload);
250 const APInt *payload = 0) {
251 return makeNaN(Sem,
true, Negative, payload);
270 bool Negative =
false);
285 void Emit(Serializer &S)
const;
447 unsigned FormatMaxPadding = 3)
const;
460 unsigned int partCount()
const;
472 void incrementSignificand();
474 void shiftSignificandLeft(
unsigned int);
476 unsigned int significandLSB()
const;
477 unsigned int significandMSB()
const;
478 void zeroSignificand();
480 bool isSignificandAllOnes()
const;
482 bool isSignificandAllZeros()
const;
499 void makeLargest(
bool Neg =
false);
500 void makeSmallest(
bool Neg =
false);
501 void makeNaN(
bool SNaN =
false,
bool Neg =
false,
const APInt *fill = 0);
504 void makeInf(
bool Neg =
false);
505 void makeZero(
bool Neg =
false);
512 bool convertFromStringSpecials(
StringRef str);
524 char *convertNormalToHexString(
char *,
unsigned int,
bool,
531 APInt convertHalfAPFloatToAPInt()
const;
532 APInt convertFloatAPFloatToAPInt()
const;
533 APInt convertDoubleAPFloatToAPInt()
const;
534 APInt convertQuadrupleAPFloatToAPInt()
const;
535 APInt convertF80LongDoubleAPFloatToAPInt()
const;
536 APInt convertPPCDoubleDoubleAPFloatToAPInt()
const;
538 void initFromHalfAPInt(
const APInt &api);
539 void initFromFloatAPInt(
const APInt &api);
540 void initFromDoubleAPInt(
const APInt &api);
541 void initFromQuadrupleAPInt(
const APInt &api);
542 void initFromF80LongDoubleAPInt(
const APInt &api);
543 void initFromPPCDoubleDoubleAPInt(
const APInt &api);
546 void copySignificand(
const APFloat &);
547 void freeSignificand();
570 unsigned int sign : 1;
580 #endif // LLVM_ADT_APFLOAT_H
opStatus divide(const APFloat &, roundingMode)
bool isNaN() const
Returns true if and only if the float is a quiet or signaling NaN.
APFloat & operator=(const APFloat &)
void Profile(FoldingSetNodeID &NID) const
static const fltSemantics IEEEdouble
APFloat(const fltSemantics &)
static APFloat getZero(const fltSemantics &Sem, bool Negative=false)
static const fltSemantics Bogus
bool isSignaling() const
Returns true if and only if the float is a signaling NaN.
bool isFiniteNonZero() const
opStatus convertFromString(StringRef, roundingMode)
bool bitwiseIsEqual(const APFloat &) const
Bitwise comparison for equality (QNaNs compare equal, 0!=-0).
static const fltSemantics x87DoubleExtended
signed short ExponentType
A signed type to represent a floating point numbers unbiased exponent.
opStatus convertToInteger(integerPart *, unsigned int, bool, roundingMode, bool *) const
static APFloat getQNaN(const fltSemantics &Sem, bool Negative=false, const APInt *payload=0)
Factory for QNaN values.
static const fltSemantics IEEEquad
static APFloat getSNaN(const fltSemantics &Sem, bool Negative=false, const APInt *payload=0)
Factory for SNaN values.
void copySign(const APFloat &)
This file implements a class to represent arbitrary precision integral constant values and operations...
uninitializedTag
Convenience enum used to construct an uninitialized APFloat.
opStatus convertFromZeroExtendedInteger(const integerPart *, unsigned int, bool, roundingMode)
bool operator==(const APFloat &) const LLVM_DELETED_FUNCTION
static APFloat getSmallest(const fltSemantics &Sem, bool Negative=false)
hash_code hash_value(const APFloat &Arg)
static unsigned int semanticsPrecision(const fltSemantics &)
double convertToDouble() const
static APFloat getInf(const fltSemantics &Sem, bool Negative=false)
unsigned int convertToHexString(char *dst, unsigned int hexDigits, bool upperCase, roundingMode) const
opStatus mod(const APFloat &, roundingMode)
C fmod, or llvm frem.
opStatus convertFromAPInt(const APInt &, bool, roundingMode)
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
friend hash_code hash_value(const APFloat &Arg)
Overload to compute a hash code for an APFloat value.
static APFloat getSmallestNormalized(const fltSemantics &Sem, bool Negative=false)
cmpResult compare(const APFloat &) const
fltCategory
Category of internally-represented number.
opStatus fusedMultiplyAdd(const APFloat &, const APFloat &, roundingMode)
static APFloat ReadVal(Deserializer &D)
Used by the Bitcode deserializer to deserialize APInts.
opStatus convert(const fltSemantics &, roundingMode, bool *)
fltCategory getCategory() const
static const fltSemantics IEEEhalf
bool needsCleanup() const
Returns whether this instance allocated memory.
opStatus convertFromSignExtendedInteger(const integerPart *, unsigned int, bool, roundingMode)
static const fltSemantics PPCDoubleDouble
roundingMode
IEEE-754R 4.3: Rounding-direction attributes.
opStatus add(const APFloat &, roundingMode)
opStatus multiply(const APFloat &, roundingMode)
static APFloat getAllOnesValue(unsigned BitWidth, bool isIEEE=false)
#define LLVM_DELETED_FUNCTION
Class for arbitrary precision integers.
APInt bitcastToAPInt() const
static APFloat getLargest(const fltSemantics &Sem, bool Negative=false)
An opaque object representing a hash code.
static APFloat getNaN(const fltSemantics &Sem, bool Negative=false, unsigned type=0)
void toString(SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3) const
static const fltSemantics IEEEsingle
opStatus roundToIntegral(roundingMode)
float convertToFloat() const
void Emit(Serializer &S) const
Used by the Bitcode serializer to emit APInts to Bitcode.
bool isZero() const
Returns true if and only if the float is plus or minus zero.
bool isInfinity() const
IEEE-754R isInfinite(): Returns true if and only if the float is infinity.
opStatus next(bool nextDown)
IEEE-754R 5.3.1: nextUp/nextDown.
opStatus remainder(const APFloat &)
IEEE remainder.
cmpResult
IEEE-754R 5.11: Floating Point Comparison Relations.
bool getExactInverse(APFloat *inv) const
const fltSemantics & getSemantics() const
opStatus subtract(const APFloat &, roundingMode)