52 "mantissa bits must be less than "
53 "originating type width");
112 std::size_t
trunc_pos=result.find_last_not_of(
'0');
117 if(!result.empty() && result.back()==
'.')
118 result.resize(result.size()-1);
135 while(
tmp!=0) { ++result;
tmp/=10; }
162 for(std::size_t i=0; i<precision; i++)
180 for(std::size_t i=0; i<precision; i++)
193 if(position>precision)
209 const std::size_t
dot =
211 result+=std::string(
tmp, 0,
dot)+
'.';
212 result+=std::string(
tmp,
dot, std::string::npos);
256 for(std::size_t i=0; i<precision; i++)
283 else if(remainder>p/2)
302 result+=
decimals.substr(1, precision);
562 "normalisation result must be >= lower bound");
565 "normalisation result must be < upper bound");
573 "normalisation result must be >= lower bound");
576 "normalisation result must be < upper bound");
656 const mp_integer remainder = dividend % divisor;
676 if((dividend % 2) != 0)
878 "prior block equalises the exponents by setting both to the "
879 "minimum of their previous values while adjusting the mantissa");
1024 return *
this==other;
1031 return *
this==other;
1036 return !(*
this==other);
1046 return *
this!=other;
1102 std::numeric_limits<double>::is_iec559,
1103 "this requires the double layout is according to the ieee754 "
1106 sizeof(
double) ==
sizeof(std::uint64_t),
"ensure double has 64 bit width");
1126 std::numeric_limits<float>::is_iec559,
1127 "this requires the float layout is according to the ieee754 "
1130 sizeof(
float) ==
sizeof(std::uint32_t),
"ensure float has 32 bit width");
1199 return -std::numeric_limits<double>::infinity();
1201 return std::numeric_limits<double>::infinity();
1207 return -std::numeric_limits<double>::quiet_NaN();
1209 return std::numeric_limits<double>::quiet_NaN();
1214 CHECK_RETURN(i <= std::numeric_limits<std::uint64_t>::max());
1226 std::numeric_limits<float>::is_iec559,
1227 "this requires the float layout is according to the IEC 559/IEEE 754 "
1230 sizeof(
float) ==
sizeof(
uint32_t),
"a 32 bit float type is required");
1237 return -std::numeric_limits<float>::infinity();
1239 return std::numeric_limits<float>::infinity();
1245 return -std::numeric_limits<float>::quiet_NaN();
1247 return std::numeric_limits<float>::quiet_NaN();
Pre-defined bitvector types.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
void set_width(std::size_t width)
std::size_t get_width() const
A constant literal expression.
const irep_idt & get_value() const
typet & type()
Return the type of the expression.
Fixed-width bit-vector with IEEE floating-point interpretation.
void set_f(std::size_t b)
std::size_t get_f() const
mp_integer max_fraction() const
class floatbv_typet to_type() const
mp_integer max_exponent() const
void from_type(const floatbv_typet &type)
static ieee_float_spect double_precision()
std::size_t width() const
ieee_floatt & operator*=(const ieee_floatt &other)
void extract_base10(mp_integer &_exponent, mp_integer &_fraction) const
void make_minus_infinity()
void extract_base2(mp_integer &_exponent, mp_integer &_fraction) const
float to_float() const
Note that calling from_float -> to_float can return different bit patterns for NaN.
void unpack(const mp_integer &i)
mp_integer to_integer() const
std::string to_ansi_c_string() const
void make_plus_infinity()
bool operator!=(const ieee_floatt &other) const
bool ieee_equal(const ieee_floatt &other) const
ieee_floatt & operator+=(const ieee_floatt &other)
constant_exprt to_expr() const
void divide_and_round(mp_integer ÷nd, const mp_integer &divisor)
void set_sign(bool _sign)
void from_float(const float f)
void from_expr(const constant_exprt &expr)
bool operator==(const ieee_floatt &other) const
static constant_exprt rounding_mode_expr(rounding_modet)
bool operator<=(const ieee_floatt &other) const
std::string to_string_scientific(std::size_t precision) const
format as [-]d.ddde+-d Note that printf always produces at least two digits for the exponent.
std::string to_string_decimal(std::size_t precision) const
ieee_floatt & operator-=(const ieee_floatt &other)
bool operator>(const ieee_floatt &other) const
void next_representable(bool greater)
Sets *this to the next representable number closer to plus infinity (greater = true) or minus infinit...
bool ieee_not_equal(const ieee_floatt &other) const
double to_double() const
Note that calling from_double -> to_double can return different bit patterns for NaN.
ieee_floatt & operator/=(const ieee_floatt &other)
bool operator>=(const ieee_floatt &other) const
std::string format(const format_spect &format_spec) const
void from_integer(const mp_integer &i)
rounding_modet rounding_mode
static mp_integer base10_digits(const mp_integer &src)
void build(const mp_integer &exp, const mp_integer &frac)
void from_base10(const mp_integer &exp, const mp_integer &frac)
compute f * (10^e)
void from_double(const double d)
bool operator<(const ieee_floatt &other) const
void change_spec(const ieee_float_spect &dest_spec)
void print(std::ostream &out) const
bool get_bool(const irep_idt &name) const
void set(const irep_idt &name, const irep_idt &value)
void dot(const goto_modelt &src, std::ostream &out)
constant_exprt floatbv_rounding_mode(unsigned rm)
returns the a rounding mode expression for a given IEEE rounding mode, encoded using the recommendati...
API to expression classes for floating-point arithmetic.
const std::string integer2string(const mp_integer &n, unsigned base)
#define CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
API to expression classes.