Exemple #1
0
_Float32x
__f32xsubf64 (_Float64 x, _Float64 y)
{
  /* To avoid double rounding, set double precision for the subtraction.
     math_narrow_eval is still needed to eliminate excess range in the
     case of overflow.  If the result of the subtraction is in the
     subnormal range for double, it is exact, so no issues of double
     rounding for subnormals arise.  */
  fpu_control_t cw, cw_double;
  _FPU_GETCW (cw);
  cw_double = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
  _FPU_SETCW (cw_double);
  _Float32x ret = math_narrow_eval (x - y);
  _FPU_SETCW (cw);
  CHECK_NARROW_SUB (ret, x, y);
  return ret;
}
Exemple #2
0
float
__fsubl (_Float128 x, _Float128 y)
{
  FP_DECL_EX;
  FP_DECL_Q (X);
  FP_DECL_Q (Y);
  FP_DECL_Q (R);
  FP_DECL_S (RN);
  float ret;

  FP_INIT_ROUNDMODE;
  FP_UNPACK_SEMIRAW_Q (X, x);
  FP_UNPACK_SEMIRAW_Q (Y, y);
  FP_SUB_Q (R, X, Y);
#if _FP_W_TYPE_SIZE < 64
  FP_TRUNC (S, Q, 1, 4, RN, R);
#else
  FP_TRUNC (S, Q, 1, 2, RN, R);
#endif
  FP_PACK_SEMIRAW_S (ret, RN);
  FP_HANDLE_EXCEPTIONS;
  CHECK_NARROW_SUB (ret, x, y);
  return ret;
}