1b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner//== llvm/Support/APFloat.h - Arbitrary Precision Floating Point -*- C++ -*-==// 2b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner// 3b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner// The LLVM Compiler Infrastructure 4b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner// 57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source 67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details. 7b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner// 8b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner//===----------------------------------------------------------------------===// 97f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 107f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// \file 117f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// \brief 127f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// This file declares a class to represent arbitrary precision floating point 137f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// values and provide a variety of arithmetic operations on them. 147f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 15b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner//===----------------------------------------------------------------------===// 16b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner 17674be02d525d4e24bc6943ed9274958c580bcfbcJakub Staszak#ifndef LLVM_ADT_APFLOAT_H 18674be02d525d4e24bc6943ed9274958c580bcfbcJakub Staszak#define LLVM_ADT_APFLOAT_H 19b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner 20b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner#include "llvm/ADT/APInt.h" 21b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner 22b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattnernamespace llvm { 23b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner 24fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesmanstruct fltSemantics; 25fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesmanclass APSInt; 26fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesmanclass StringRef; 27fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 287f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Enum that represents what fraction of the LSB truncated bits of an fp number 297f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// represent. 307f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 317f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// This essentially combines the roles of guard and sticky bits. 32fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesmanenum lostFraction { // Example of truncated bits: 33fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman lfExactlyZero, // 000000 34fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman lfLessThanHalf, // 0xxxxx x's not all zero 35fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman lfExactlyHalf, // 100000 36fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman lfMoreThanHalf // 1xxxxx x's not all zero 37fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman}; 38fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 397f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// \brief A self-contained host- and target-independent arbitrary-precision 407f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// floating-point software implementation. 417f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 427f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// APFloat uses bignum integer arithmetic as provided by static functions in 437f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// the APInt class. The library will work with bignum integers whose parts are 447f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// any unsigned type at least 16 bits wide, but 64 bits is recommended. 457f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 467f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Written for clarity rather than speed, in particular with a view to use in 477f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// the front-end of a cross compiler so that target arithmetic can be correctly 487f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// performed on the host. Performance should nonetheless be reasonable, 497f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// particularly for its intended use. It may be useful as a base 507f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// implementation for a run-time library during development of a faster 517f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// target-specific one. 527f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 537f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// All 5 rounding modes in the IEEE-754R draft are handled correctly for all 547f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// implemented operations. Currently implemented operations are add, subtract, 557f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// multiply, divide, fused-multiply-add, conversion-to-float, 567f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// conversion-to-integer and conversion-from-integer. New rounding modes 577f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// (e.g. away from zero) can be added with three or four lines of code. 587f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 597f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Four formats are built-in: IEEE single precision, double precision, 607f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// quadruple precision, and x87 80-bit extended double (when operating with 617f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// full extended precision). Adding a new format that obeys IEEE semantics 627f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// only requires adding two lines of code: a declaration and definition of the 637f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// format. 647f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 657f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// All operations return the status of that operation as an exception bit-mask, 667f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// so multiple operations can be done consecutively with their results or-ed 677f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// together. The returned status can be useful for compiler diagnostics; e.g., 687f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// inexact, underflow and overflow can be easily diagnosed on constant folding, 697f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// and compiler optimizers can determine what exceptions would be raised by 707f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// folding operations and optimize, or perhaps not optimize, accordingly. 717f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 727f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// At present, underflow tininess is detected after rounding; it should be 737f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// straight forward to add support for the before-rounding case too. 747f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 757f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// The library reads hexadecimal floating point numbers as per C99, and 767f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// correctly rounds if necessary according to the specified rounding mode. 777f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Syntax is required to have been validated by the caller. It also converts 787f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// floating point numbers to hexadecimal text as per the C99 %a and %A 797f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// conversions. The output precision (or alternatively the natural minimal 807f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// precision) can be specified; if the requested precision is less than the 817f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// natural precision the output is correctly rounded for the specified rounding 827f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// mode. 837f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 847f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// It also reads decimal floating point numbers and correctly rounds according 857f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// to the specified rounding mode. 867f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 877f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Conversion to decimal text is not currently implemented. 887f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 897f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Non-zero finite numbers are represented internally as a sign bit, a 16-bit 907f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// signed exponent, and the significand as an array of integer parts. After 917f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// normalization of a number of precision P the exponent is within the range of 927f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// the format, and if the number is not denormal the P-th bit of the 937f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// significand is set as an explicit integer bit. For denormals the most 947f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// significant bit is shifted right so that the exponent is maintained at the 957f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// format's minimum, so that the smallest denormal has just the least 967f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// significant bit of the significand set. The sign of zeroes and infinities 977f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// is significant; the exponent and significand of such numbers is not stored, 987f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// but has a known implicit (deterministic) value: 0 for the significands, 0 997f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// for zero exponent, all 1 bits for infinity exponent. For NaNs the sign and 1007f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// significand are deterministic, although not really meaningful, and preserved 1017f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// in non-conversion operations. The exponent is implicitly all 1 bits. 1027f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 1037f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// APFloat does not provide any exception handling beyond default exception 1047f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// handling. We represent Signaling NaNs via IEEE-754R 2008 6.2.1 should clause 1057f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// by encoding Signaling NaNs with the first bit of its trailing significand as 1067f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 0. 1077f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 1087f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// TODO 1097f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// ==== 1107f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 1117f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Some features that may or may not be worth adding: 1127f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 1137f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Binary to decimal conversion (hard). 1147f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 1157f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// Optional ability to detect underflow tininess before rounding. 1167f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 1177f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// New formats: x87 in single and double precision mode (IEEE apart from 1187f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// extended exponent range) (hard). 1197f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 1207ffc854002282b0a6fd018d967a6def971dc341eMichael Gottesman/// New operations: sqrt, IEEE remainder, C90 fmod, nexttoward. 1217f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 122fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesmanclass APFloat { 123fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesmanpublic: 124fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 125db045ab1532469551a56e5811e684920a6f7a10cMichael Gottesman /// A signed type to represent a floating point numbers unbiased exponent. 126db045ab1532469551a56e5811e684920a6f7a10cMichael Gottesman typedef signed short ExponentType; 127db045ab1532469551a56e5811e684920a6f7a10cMichael Gottesman 1287f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Floating Point Semantics. 1297f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 1307f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 131fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static const fltSemantics IEEEhalf; 132fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static const fltSemantics IEEEsingle; 133fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static const fltSemantics IEEEdouble; 134fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static const fltSemantics IEEEquad; 135fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static const fltSemantics PPCDoubleDouble; 136fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static const fltSemantics x87DoubleExtended; 1377f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 1387f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// A Pseudo fltsemantic used to construct APFloats that cannot conflict with 1397f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// anything real. 140fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static const fltSemantics Bogus; 141fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 1422e2922cd90922eaf3736421bd0ad4331f89f3e75Michael Gottesman /// @} 1432e2922cd90922eaf3736421bd0ad4331f89f3e75Michael Gottesman 144fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static unsigned int semanticsPrecision(const fltSemantics &); 145fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 1467f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// IEEE-754R 5.11: Floating Point Comparison Relations. 147fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman enum cmpResult { 148fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman cmpLessThan, 149fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman cmpEqual, 150fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman cmpGreaterThan, 151fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman cmpUnordered 152b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner }; 153b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner 1547f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// IEEE-754R 4.3: Rounding-direction attributes. 155fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman enum roundingMode { 156fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman rmNearestTiesToEven, 157fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman rmTowardPositive, 158fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman rmTowardNegative, 159fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman rmTowardZero, 160fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman rmNearestTiesToAway 161fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman }; 162e12b73816b50bbe2cc54b8005d86c95413b4f465John McCall 1637f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// IEEE-754R 7: Default exception handling. 1647f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// 1657f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// opUnderflow or opOverflow are always returned or-ed with opInexact. 166fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman enum opStatus { 167fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opOK = 0x00, 168fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opInvalidOp = 0x01, 169fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opDivByZero = 0x02, 170fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opOverflow = 0x04, 171fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opUnderflow = 0x08, 172fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opInexact = 0x10 173fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman }; 174e12b73816b50bbe2cc54b8005d86c95413b4f465John McCall 1757f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Category of internally-represented number. 176fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman enum fltCategory { 177fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman fcInfinity, 178fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman fcNaN, 179fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman fcNormal, 180fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman fcZero 181fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman }; 1823a54b3dc87a581c203b18050b4f787b4ca28a12cMisha Brukman 1837f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Convenience enum used to construct an uninitialized APFloat. 184fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman enum uninitializedTag { 185fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman uninitialized 186b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner }; 1873a9b71434cda6f66d65a031effec1bbe58e1dda3Rafael Espindola 1887f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Constructors 1897f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 1907f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 191fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APFloat(const fltSemantics &); // Default construct to 0.0 192fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APFloat(const fltSemantics &, StringRef); 193fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APFloat(const fltSemantics &, integerPart); 194fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APFloat(const fltSemantics &, uninitializedTag); 195fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APFloat(const fltSemantics &, const APInt &); 196fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman explicit APFloat(double d); 197fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman explicit APFloat(float f); 198fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APFloat(const APFloat &); 199fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman ~APFloat(); 200fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2017f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 2027f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 203abff3aa8217049cffe6da77c91e510c66b8c2313Manuel Klimek /// \brief Returns whether this instance allocated memory. 204abff3aa8217049cffe6da77c91e510c66b8c2313Manuel Klimek bool needsCleanup() const { return partCount() > 1; } 205abff3aa8217049cffe6da77c91e510c66b8c2313Manuel Klimek 2067f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Convenience "constructors" 2077f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 2087f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 2098a70f5815dda98d23f0bbf519532703886159cdaMichael Gottesman /// Factory for Positive and Negative Zero. 2108a70f5815dda98d23f0bbf519532703886159cdaMichael Gottesman /// 2118a70f5815dda98d23f0bbf519532703886159cdaMichael Gottesman /// \param Negative True iff the number should be negative. 212fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getZero(const fltSemantics &Sem, bool Negative = false) { 213fdec0c7a7302702d08f1221609221018af8085ecMichael Gottesman APFloat Val(Sem, uninitialized); 214fdec0c7a7302702d08f1221609221018af8085ecMichael Gottesman Val.makeZero(Negative); 215fdec0c7a7302702d08f1221609221018af8085ecMichael Gottesman return Val; 216fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman } 2178a70f5815dda98d23f0bbf519532703886159cdaMichael Gottesman 2188a70f5815dda98d23f0bbf519532703886159cdaMichael Gottesman /// Factory for Positive and Negative Infinity. 2198a70f5815dda98d23f0bbf519532703886159cdaMichael Gottesman /// 2208a70f5815dda98d23f0bbf519532703886159cdaMichael Gottesman /// \param Negative True iff the number should be negative. 221fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getInf(const fltSemantics &Sem, bool Negative = false) { 222fdec0c7a7302702d08f1221609221018af8085ecMichael Gottesman APFloat Val(Sem, uninitialized); 223fdec0c7a7302702d08f1221609221018af8085ecMichael Gottesman Val.makeInf(Negative); 224fdec0c7a7302702d08f1221609221018af8085ecMichael Gottesman return Val; 225fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman } 226fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2277f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Factory for QNaN values. 228fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 229fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param Negative - True iff the NaN generated should be negative. 230fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param type - The unspecified fill bits for creating the NaN, 0 by 231fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// default. The value is truncated as necessary. 232fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getNaN(const fltSemantics &Sem, bool Negative = false, 233fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman unsigned type = 0) { 234fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman if (type) { 235fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APInt fill(64, type); 236fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman return getQNaN(Sem, Negative, &fill); 237fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman } else { 238fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman return getQNaN(Sem, Negative, 0); 239fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman } 240fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman } 241fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2427f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Factory for QNaN values. 243fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getQNaN(const fltSemantics &Sem, bool Negative = false, 244fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman const APInt *payload = 0) { 245fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman return makeNaN(Sem, false, Negative, payload); 246fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman } 247fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2487f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Factory for SNaN values. 249fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getSNaN(const fltSemantics &Sem, bool Negative = false, 250fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman const APInt *payload = 0) { 251fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman return makeNaN(Sem, true, Negative, payload); 252fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman } 253fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2547f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Returns the largest finite number in the given semantics. 255fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 256fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param Negative - True iff the number should be negative 257fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getLargest(const fltSemantics &Sem, bool Negative = false); 258fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2597f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Returns the smallest (by magnitude) finite number in the given semantics. 2607f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Might be denormalized, which implies a relative loss of precision. 261fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 262fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param Negative - True iff the number should be negative 263fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getSmallest(const fltSemantics &Sem, bool Negative = false); 264fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2657f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Returns the smallest (by magnitude) normalized finite number in the given 2667f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// semantics. 267fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 268fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param Negative - True iff the number should be negative 269fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getSmallestNormalized(const fltSemantics &Sem, 270fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool Negative = false); 271fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2727f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Returns a float which is bitcasted from an all one value int. 273fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 274fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param BitWidth - Select float type 275fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param isIEEE - If 128 bit number, select between PPC and IEEE 276fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat getAllOnesValue(unsigned BitWidth, bool isIEEE = false); 277fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2787f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 2797f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 2807f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Used to insert APFloat objects, or objects that contain APFloat objects, 2817f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// into FoldingSets. 282fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void Profile(FoldingSetNodeID &NID) const; 283fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2847f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \brief Used by the Bitcode serializer to emit APInts to Bitcode. 285fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void Emit(Serializer &S) const; 286fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2877f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \brief Used by the Bitcode deserializer to deserialize APInts. 288fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat ReadVal(Deserializer &D); 289fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 2907f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Arithmetic 2917f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 2927f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 293fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus add(const APFloat &, roundingMode); 294fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus subtract(const APFloat &, roundingMode); 295fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus multiply(const APFloat &, roundingMode); 296fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus divide(const APFloat &, roundingMode); 2977f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// IEEE remainder. 298fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus remainder(const APFloat &); 2997f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// C fmod, or llvm frem. 300fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus mod(const APFloat &, roundingMode); 301fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus fusedMultiplyAdd(const APFloat &, const APFloat &, roundingMode); 302fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus roundToIntegral(roundingMode); 303964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman /// IEEE-754R 5.3.1: nextUp/nextDown. 304964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman opStatus next(bool nextDown); 305fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 306d3d03fe758d4ee93ea225c6740742eb56b6dca3bMichael Gottesman /// @} 307d3d03fe758d4ee93ea225c6740742eb56b6dca3bMichael Gottesman 3087f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Sign operations. 3097f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 3107f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 311fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void changeSign(); 312fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void clearSign(); 313fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void copySign(const APFloat &); 314fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 3157f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 3167f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 3177f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Conversions 3187f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 3197f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 320fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convert(const fltSemantics &, roundingMode, bool *); 321fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertToInteger(integerPart *, unsigned int, bool, roundingMode, 322fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool *) const; 323fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertToInteger(APSInt &, roundingMode, bool *) const; 324fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertFromAPInt(const APInt &, bool, roundingMode); 325fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertFromSignExtendedInteger(const integerPart *, unsigned int, 326fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool, roundingMode); 327fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertFromZeroExtendedInteger(const integerPart *, unsigned int, 328fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool, roundingMode); 329fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertFromString(StringRef, roundingMode); 330fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APInt bitcastToAPInt() const; 331fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman double convertToDouble() const; 332fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman float convertToFloat() const; 333fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 3347f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 3357f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 3367f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// The definition of equality is not straightforward for floating point, so 3377f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// we won't use operator==. Use one of the following, or write whatever it 3387f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// is you really mean. 339fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool operator==(const APFloat &) const LLVM_DELETED_FUNCTION; 340fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 3417f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// IEEE comparison with another floating point number (NaNs compare 3427f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// unordered, 0==-0). 343fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman cmpResult compare(const APFloat &) const; 344fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 3457f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Bitwise comparison for equality (QNaNs compare equal, 0!=-0). 346fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool bitwiseIsEqual(const APFloat &) const; 347fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 3487f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Write out a hexadecimal representation of the floating point value to DST, 3497f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// which must be of sufficient size, in the C99 form [-]0xh.hhhhp[+-]d. 3507f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Return the number of characters written, excluding the terminating NUL. 351fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman unsigned int convertToHexString(char *dst, unsigned int hexDigits, 352fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool upperCase, roundingMode) const; 353fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 354b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// \name IEEE-754R 5.7.2 General operations. 355b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// @{ 356b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 357b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// IEEE-754R isSignMinus: Returns true if and only if the current value is 358b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// negative. 359b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// 360b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// This applies to zeros and NaNs as well. 361b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman bool isNegative() const { return sign; } 362b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 363b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// IEEE-754R isNormal: Returns true if and only if the current value is normal. 364b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// 365b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// This implies that the current value of the float is not zero, subnormal, 366b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// infinite, or NaN following the definition of normality from IEEE-754R. 367a1694e578492c90c246e59ec861c1a34f8ad7b4dMichael Gottesman bool isNormal() const { return !isDenormal() && isFiniteNonZero(); } 368b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 369b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// Returns true if and only if the current value is zero, subnormal, or 370b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// normal. 371b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// 372b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// This means that the value is not infinite or NaN. 373b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman bool isFinite() const { return !isNaN() && !isInfinity(); } 374b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 375b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// Returns true if and only if the float is plus or minus zero. 376b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman bool isZero() const { return category == fcZero; } 377b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 378b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// IEEE-754R isSubnormal(): Returns true if and only if the float is a 379b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// denormal. 380b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman bool isDenormal() const; 381b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 382b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// IEEE-754R isInfinite(): Returns true if and only if the float is infinity. 383b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman bool isInfinity() const { return category == fcInfinity; } 384b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 385b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// Returns true if and only if the float is a quiet or signaling NaN. 386b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman bool isNaN() const { return category == fcNaN; } 387b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 388b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// Returns true if and only if the float is a signaling NaN. 389b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman bool isSignaling() const; 390b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 391b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman /// @} 392b30718af1ada4b68c7c44e3dcbf4891efd5e3ba1Michael Gottesman 3937f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Simple Queries 3947f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 3957f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 396fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman fltCategory getCategory() const { return category; } 397fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman const fltSemantics &getSemantics() const { return *semantics; } 398fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool isNonZero() const { return category != fcZero; } 3997032c883cdf8da579fbf9bf499d36a711eef676fMichael Gottesman bool isFiniteNonZero() const { return isFinite() && !isZero(); } 400fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool isPosZero() const { return isZero() && !isNegative(); } 401fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool isNegZero() const { return isZero() && isNegative(); } 402fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 403c896020dd8d6c2f25f5bf7eb9191fd4e72407015Michael Gottesman /// Returns true if and only if the number has the smallest possible non-zero 404c896020dd8d6c2f25f5bf7eb9191fd4e72407015Michael Gottesman /// magnitude in the current semantics. 405c896020dd8d6c2f25f5bf7eb9191fd4e72407015Michael Gottesman bool isSmallest() const; 406c896020dd8d6c2f25f5bf7eb9191fd4e72407015Michael Gottesman 407c896020dd8d6c2f25f5bf7eb9191fd4e72407015Michael Gottesman /// Returns true if and only if the number has the largest possible finite 408c896020dd8d6c2f25f5bf7eb9191fd4e72407015Michael Gottesman /// magnitude in the current semantics. 409c896020dd8d6c2f25f5bf7eb9191fd4e72407015Michael Gottesman bool isLargest() const; 410c896020dd8d6c2f25f5bf7eb9191fd4e72407015Michael Gottesman 4117f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 4127f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 413fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APFloat &operator=(const APFloat &); 414fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 415fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \brief Overload to compute a hash code for an APFloat value. 416fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 417fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// Note that the use of hash codes for floating point values is in general 418fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// frought with peril. Equality is hard to define for these values. For 419fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// example, should negative and positive zero hash to different codes? Are 420fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// they equal or not? This hash value implementation specifically 421fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// emphasizes producing different codes for different inputs in order to 422fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// be used in canonicalization and memoization. As such, equality is 423fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// bitwiseIsEqual, and 0 != -0. 424fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman friend hash_code hash_value(const APFloat &Arg); 425fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 426fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// Converts this value into a decimal string. 427fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 428fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param FormatPrecision The maximum number of digits of 429fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// precision to output. If there are fewer digits available, 430fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// zero padding will not be used unless the value is 431fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// integral and small enough to be expressed in 432fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// FormatPrecision digits. 0 means to use the natural 433fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// precision of the number. 434fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// \param FormatMaxPadding The maximum number of zeros to 435fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// consider inserting before falling back to scientific 436fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// notation. 0 means to always use scientific notation. 437fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 438fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// Number Precision MaxPadding Result 439fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// ------ --------- ---------- ------ 440fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 1.01E+4 5 2 10100 441fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 1.01E+4 4 2 1.01E+4 442fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 1.01E+4 5 1 1.01E+4 443fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 1.01E-2 5 2 0.0101 444fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 1.01E-2 4 2 0.0101 445fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman /// 1.01E-2 4 1 1.01E-2 446fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void toString(SmallVectorImpl<char> &Str, unsigned FormatPrecision = 0, 447fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman unsigned FormatMaxPadding = 3) const; 448fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 4497f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// If this value has an exact multiplicative inverse, store it in inv and 4507f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// return true. 451fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool getExactInverse(APFloat *inv) const; 452fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 453fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesmanprivate: 454fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 4557f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Simple Queries 4567f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 4577f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 458fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman integerPart *significandParts(); 459fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman const integerPart *significandParts() const; 460fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman unsigned int partCount() const; 461fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 4627f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 4637f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 4647f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Significand operations. 4657f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 4667f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 467fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman integerPart addSignificand(const APFloat &); 468fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman integerPart subtractSignificand(const APFloat &, integerPart); 469fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman lostFraction addOrSubtractSignificand(const APFloat &, bool subtract); 470fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman lostFraction multiplySignificand(const APFloat &, const APFloat *); 471fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman lostFraction divideSignificand(const APFloat &); 472fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void incrementSignificand(); 473fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void initialize(const fltSemantics *); 474fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void shiftSignificandLeft(unsigned int); 475fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman lostFraction shiftSignificandRight(unsigned int); 476fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman unsigned int significandLSB() const; 477fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman unsigned int significandMSB() const; 478fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void zeroSignificand(); 479964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman /// Return true if the significand excluding the integral bit is all ones. 480964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman bool isSignificandAllOnes() const; 481964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman /// Return true if the significand excluding the integral bit is all zeros. 482964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman bool isSignificandAllZeros() const; 483fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 4847f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 4857f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 4867f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Arithmetic on special values. 4877f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 4887f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 489fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus addOrSubtractSpecials(const APFloat &, bool subtract); 490fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus divideSpecials(const APFloat &); 491fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus multiplySpecials(const APFloat &); 492fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus modSpecials(const APFloat &); 493fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 4947f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 4957f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 4967f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Special value setters. 4977f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 4987f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 499964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman void makeLargest(bool Neg = false); 500964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman void makeSmallest(bool Neg = false); 501964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman void makeNaN(bool SNaN = false, bool Neg = false, const APInt *fill = 0); 502fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman static APFloat makeNaN(const fltSemantics &Sem, bool SNaN, bool Negative, 503fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman const APInt *fill); 504fdec0c7a7302702d08f1221609221018af8085ecMichael Gottesman void makeInf(bool Neg = false); 505fdec0c7a7302702d08f1221609221018af8085ecMichael Gottesman void makeZero(bool Neg = false); 506964722ca40f48c65605e459e3a732bb8783b92f6Michael Gottesman 5077f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 5087f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 5097f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// \name Miscellany 5107f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @{ 5117f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 512575694b6a7d49004acc93294bc88d0bc337e4d27Michael Gottesman bool convertFromStringSpecials(StringRef str); 513fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus normalize(roundingMode, lostFraction); 514fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus addOrSubtract(const APFloat &, roundingMode, bool subtract); 515fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman cmpResult compareAbsoluteValue(const APFloat &) const; 516fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus handleOverflow(roundingMode); 517fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman bool roundAwayFromZero(roundingMode, lostFraction, unsigned int) const; 518fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertToSignExtendedInteger(integerPart *, unsigned int, bool, 519fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman roundingMode, bool *) const; 520fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertFromUnsignedParts(const integerPart *, unsigned int, 521fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman roundingMode); 522fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertFromHexadecimalString(StringRef, roundingMode); 523fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus convertFromDecimalString(StringRef, roundingMode); 524fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman char *convertNormalToHexString(char *, unsigned int, bool, 525fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman roundingMode) const; 526fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman opStatus roundSignificandWithExponent(const integerPart *, unsigned int, int, 527fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman roundingMode); 528fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 5297f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// @} 5307f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman 531fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APInt convertHalfAPFloatToAPInt() const; 532fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APInt convertFloatAPFloatToAPInt() const; 533fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APInt convertDoubleAPFloatToAPInt() const; 534fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APInt convertQuadrupleAPFloatToAPInt() const; 535fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APInt convertF80LongDoubleAPFloatToAPInt() const; 536fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman APInt convertPPCDoubleDoubleAPFloatToAPInt() const; 537fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void initFromAPInt(const fltSemantics *Sem, const APInt &api); 538fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void initFromHalfAPInt(const APInt &api); 539fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void initFromFloatAPInt(const APInt &api); 540fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void initFromDoubleAPInt(const APInt &api); 541fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void initFromQuadrupleAPInt(const APInt &api); 542fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void initFromF80LongDoubleAPInt(const APInt &api); 543fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void initFromPPCDoubleDoubleAPInt(const APInt &api); 544fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 545fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void assign(const APFloat &); 546fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void copySignificand(const APFloat &); 547fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman void freeSignificand(); 548fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 5497f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// The semantics that this value obeys. 550fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman const fltSemantics *semantics; 551fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 5527f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// A binary fraction with an explicit integer bit. 5537f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// 5547f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// The significand must be at least one bit wider than the target precision. 555fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman union Significand { 556fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman integerPart part; 557fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman integerPart *parts; 558fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman } significand; 559fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 5607f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// The signed unbiased exponent of the value. 561db045ab1532469551a56e5811e684920a6f7a10cMichael Gottesman ExponentType exponent; 562fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 5637f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// What kind of floating point number this is. 5647f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// 5657f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Only 2 bits are required, but VisualStudio incorrectly sign extends it. 5667f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Using the extra bit keeps it from failing under VisualStudio. 567fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman fltCategory category : 3; 568fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 5697f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman /// Sign bit of the number. 570fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman unsigned int sign : 1; 571fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman}; 572fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesman 5737f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// See friend declaration above. 5747f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// 5757f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// This additional declaration is required in order to compile LLVM with IBM 5767f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman/// xlC compiler. 577fce7b6b5d9905bf35641ee7f001b6b66dbc26c2dMichael Gottesmanhash_code hash_value(const APFloat &Arg); 5787f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman} // namespace llvm 579b39cdde41d3c91d1fd48a038e63b78122607bb10Chris Lattner 5807f88a3b20dbaee2a9b265f60a7bc19d2dc6a8f3eMichael Gottesman#endif // LLVM_ADT_APFLOAT_H 581