Home | History | Annotate | Download | only in ADT

Lines Matching defs:APFloat

1 //===- llvm/ADT/APFloat.h - Arbitrary Precision Floating Point ---*- C++ -*-==//
29 class APFloat;
48 /// APFloat uses bignum integer arithmetic as provided by static functions in
109 /// APFloat does not provide any exception handling beyond default exception
129 // This is the common type definitions shared by APFloat and its internal
189 /// Convenience enum used to construct an uninitialized APFloat.
238 /// Used to insert APFloat objects, or objects that contain APFloat objects,
299 /// \brief A static helper to produce a copy of an APFloat value with its sign
300 /// copied from some other APFloat.
410 /// \brief Overload to compute a hash code for an APFloat value.
448 /// \brief Returns the exponent of the internal representation of the APFloat.
450 /// Because the radix of APFloat is 2, this is equivalent to floor(log2(x)).
451 /// For special APFloat values, this returns special error codes:
603 std::unique_ptr<APFloat[]> Floats;
605 opStatus addImpl(const APFloat &a, const APFloat &aa, const APFloat &c,
606 const APFloat &cc, roundingMode RM);
616 DoubleAPFloat(const fltSemantics &S, APFloat &&First, APFloat &&Second);
632 APFloat &getFirst() { return Floats[0]; }
633 const APFloat &getFirst() const { return Floats[0]; }
634 APFloat &getSecond() { return Floats[1]; }
635 const APFloat &getSecond() const { return Floats[1]; }
653 class APFloat : public APFloatBase {
798 APFloat() : U(IEEEdouble()) {
802 explicit APFloat(IEEEFloat F, const fltSemantics &S) : U(std::move(F), S) {}
803 explicit APFloat(DoubleAPFloat F, const fltSemantics &S)
806 cmpResult compareAbsoluteValue(const APFloat &RHS) const {
816 APFloat(const fltSemantics &Semantics) : U(Semantics) {}
817 APFloat(const fltSemantics &Semantics, StringRef S);
818 APFloat(const fltSemantics &Semantics, integerPart I) : U(Semantics, I) {}
820 APFloat(const fltSemantics &Semantics, uninitializedTag)
822 APFloat(const fltSemantics &Semantics, const APInt &I) : U(Semantics, I) {}
823 explicit APFloat(double d) : U(IEEEFloat(d), IEEEdouble()) {}
824 explicit APFloat(float f) : U(IEEEFloat(f), IEEEsingle()) {}
825 APFloat(const APFloat &RHS) = default;
826 APFloat(APFloat &&RHS) = default;
828 ~APFloat() = default;
841 static APFloat getZero(const fltSemantics &Sem, bool Negative = false) {
842 APFloat Val(Sem, uninitialized);
850 static APFloat getInf(const fltSemantics &Sem, bool Negative = false) {
851 APFloat Val(Sem, uninitialized);
861 static APFloat getNaN(const fltSemantics &Sem, bool Negative = false,
872 static APFloat getQNaN(const fltSemantics &Sem, bool Negative = false,
874 APFloat Val(Sem, uninitialized);
880 static APFloat getSNaN(const fltSemantics &Sem, bool Negative = false,
882 APFloat Val(Sem, uninitialized);
890 static APFloat getLargest(const fltSemantics &Sem, bool Negative = false) {
891 APFloat Val(Sem, uninitialized);
900 static APFloat getSmallest(const fltSemantics &Sem, bool Negative = false) {
901 APFloat Val(Sem, uninitialized);
910 static APFloat getSmallestNormalized(const fltSemantics &Sem,
912 APFloat Val(Sem, uninitialized);
921 static APFloat
925 opStatus add(const APFloat &RHS, roundingMode RM) {
932 opStatus subtract(const APFloat &RHS, roundingMode RM) {
939 opStatus multiply(const APFloat &RHS, roundingMode RM) {
942 opStatus divide(const APFloat &RHS, roundingMode RM) {
945 opStatus remainder(const APFloat &RHS) {
948 opStatus mod(const APFloat &RHS) { return getIEEE().mod(RHS.getIEEE()); }
949 opStatus fusedMultiplyAdd(const APFloat &Multiplicand, const APFloat &Addend,
959 APFloat operator+(const APFloat &RHS) const {
960 return APFloat(getIEEE() + RHS.getIEEE(), getSemantics());
963 APFloat operator-(const APFloat &RHS) const {
964 return APFloat(getIEEE() - RHS.getIEEE(), getSemantics());
967 APFloat operator*(const APFloat &RHS) const {
968 return APFloat(getIEEE() * RHS.getIEEE(), getSemantics());
971 APFloat operator/(const APFloat &RHS) const {
972 return APFloat(getIEEE() / RHS.getIEEE(), getSemantics());
977 void copySign(const APFloat &RHS) { getIEEE().copySign(RHS.getIEEE()); }
979 static APFloat copySign(APFloat Value, const APFloat &Sign) {
980 return APFloat(IEEEFloat::copySign(Value.getIEEE(), Sign.getIEEE()),
1016 bool operator==(const APFloat &) const = delete;
1018 cmpResult compare(const APFloat &RHS) const {
1022 bool bitwiseIsEqual(const APFloat &RHS) const {
1052 APFloat &operator=(const APFloat &RHS) = default;
1053 APFloat &operator=(APFloat &&RHS) = default;
1063 bool getExactInverse(APFloat *inv) const {
1069 const APFloat &getSecondFloat() const {
1074 friend hash_code hash_value(const APFloat &Arg);
1075 friend int ilogb(const APFloat &Arg) { return ilogb(Arg.getIEEE()); }
1076 friend APFloat scalbn(APFloat X, int Exp, roundingMode RM);
1077 friend APFloat frexp(const APFloat &X, int &Exp, roundingMode RM);
1086 hash_code hash_value(const APFloat &Arg);
1087 inline APFloat scalbn(APFloat X, int Exp, APFloat::roundingMode RM) {
1088 return APFloat(scalbn(X.getIEEE(), Exp, RM), X.getSemantics());
1095 inline APFloat frexp(const APFloat &X, int &Exp, APFloat::roundingMode RM) {
1096 return APFloat(frexp(X.getIEEE(), Exp, RM), X.getSemantics());
1099 inline APFloat abs(APFloat X) {
1107 inline APFloat minnum(const APFloat &A, const APFloat &B) {
1112 return (B.compare(A) == APFloat::cmpLessThan) ? B : A;
1118 inline APFloat maxnum(const APFloat &A, const APFloat &B) {
1123 return (A.compare(B) == APFloat::cmpLessThan) ? B : A;