+/*
+ * Returns non-zero if the mantissa of a floating point IEEE-754
+ * tarval is zero (i.e. 1.0Exxx)
+ */
+int tarval_ieee754_zero_mantissa(tarval *tv) {
+ assert(get_mode_arithmetic(tv->mode) == irma_ieee754);
+ return fc_zero_mantissa(tv->value);
+}
+
+/* Returns the exponent of a floating point IEEE-754 tarval. */
+int tarval_ieee754_get_exponent(tarval *tv) {
+ assert(get_mode_arithmetic(tv->mode) == irma_ieee754);
+ return fc_get_exponent(tv->value);
+}
+
+/*
+ * Check if the tarval can be converted to the given mode without
+ * precision loss.
+ */
+int tarval_ieee754_can_conv_lossless(tarval *tv, ir_mode *mode) {
+ const ieee_descriptor_t *desc = get_descriptor(mode);
+ return fc_can_lossless_conv_to(tv->value, desc);
+}
+
+/* Set the immediate precision for IEEE-754 results. */
+unsigned tarval_ieee754_set_immediate_precision(unsigned bits) {
+ return fc_set_immediate_precision(bits);
+}
+
+/* Returns non-zero if the result of the last IEEE-754 operation was exact. */
+unsigned tarval_ieee754_get_exact(void) {
+ return fc_is_exact();
+}
+
+/* Return the size of the mantissa in bits (including possible
+ implicit bits) for the given mode. */
+unsigned tarval_ieee754_get_mantissa_size(const ir_mode *mode) {
+ const ieee_descriptor_t *desc;
+
+ assert(get_mode_arithmetic(mode) == irma_ieee754);
+ desc = get_descriptor(mode);
+
+ return desc->mantissa_size + desc->explicit_one;
+}
+
+/* check if its the a floating point NaN */
+int tarval_is_NaN(tarval *tv) {
+ if (! mode_is_float(tv->mode))
+ return 0;
+ return fc_is_nan(tv->value);
+}
+
+/* check if its the a floating point +inf */
+int tarval_is_plus_inf(tarval *tv) {
+ if (! mode_is_float(tv->mode))
+ return 0;
+ return fc_is_inf(tv->value) && !fc_is_negative(tv->value);
+}
+
+/* check if its the a floating point -inf */
+int tarval_is_minus_inf(tarval *tv) {
+ if (! mode_is_float(tv->mode))
+ return 0;
+ return fc_is_inf(tv->value) && fc_is_negative(tv->value);
+}
+
+/* check if the tarval represents a finite value */
+int tarval_is_finite(tarval *tv) {
+ if (mode_is_float(tv->mode))
+ return !fc_is_nan(tv->value) && !fc_is_inf(tv->value);
+ return 1;
+}
+