/* real.c - software floating point emulation.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Contributed by Stephen L. Moshier (moshier@world.std.com).
Re-written by Richard Henderson <rth@redhat.com>
return (r->cl == rvc_nan);
}
+/* Determine whether a floating-point value X is finite. */
+
+bool
+real_isfinite (const REAL_VALUE_TYPE *r)
+{
+ return (r->cl != rvc_nan) && (r->cl != rvc_inf);
+}
+
/* Determine whether a floating-point value X is negative. */
bool
true
};
-const struct real_format coldfire_single_format =
+const struct real_format motorola_single_format =
{
encode_ieee_single,
decode_ieee_single,
true
};
-const struct real_format coldfire_double_format =
+const struct real_format motorola_double_format =
{
encode_ieee_double,
decode_ieee_double,
if (fmt->has_nans)
{
image_hi |= 32767;
- if (HOST_BITS_PER_LONG == 32)
+ if (r->canonical)
+ {
+ if (fmt->canonical_nan_lsbs_set)
+ {
+ sig_hi = (1 << 30) - 1;
+ sig_lo = 0xffffffff;
+ }
+ }
+ else if (HOST_BITS_PER_LONG == 32)
{
sig_hi = r->sig[SIGSZ-1];
sig_lo = r->sig[SIGSZ-2];
true,
true,
true,
- false
+ true
};
const struct real_format ieee_extended_intel_96_format =
}
/* Infinity and NaN return themselves. */
- if (real_isinf (x) || real_isnan (x))
+ if (!real_isfinite (x))
{
*r = *x;
return false;
/* Take care of Infinity and NaN. */
if (r->cl == rvc_inf)
{
- mpfr_set_inf (m, r->sign);
+ mpfr_set_inf (m, r->sign == 1 ? -1 : 1);
return;
}