⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x-cvsweb-markup(48)

📁 软件浮点数计算功能
💻
📖 第 1 页 / 共 5 页
字号:
  do {                                                                      \    int _i;                                                                 \    _FP_FRAC_DECL_4(_n); _FP_FRAC_DECL_4(_m);                               \    _FP_FRAC_SET_4(_n, _FP_ZEROFRAC_4);                                     \    if (_FP_FRAC_GT_4(X, Y))                                                \      {                                                                     \        _n_f[3] = X##_f[0] << (_FP_W_TYPE_SIZE - 1);                            \        _FP_FRAC_SRL_4(X, 1);                                                    \      }                                                                     \    else                                                                    \      R##_e--;                                                              \                                                                            \    /* Normalize, i.e. make the most significant bit of the                 \       denominator set. */                                                  \    _FP_FRAC_SLL_4(Y, _FP_WFRACXBITS_##fs);                                 \                                                                            \    for (_i = 3; ; _i--)                                                    \      {                                                                     \        if (X##_f[3] == Y##_f[3])                                           \          {                                                                 \            /* This is a special case, not an optimization                  \               (X##_f[3]/Y##_f[3] would not fit into UWtype).               \               As X## is guaranteed to be < Y,  R##_f[_i] can be either     \               (UWtype)-1 or (UWtype)-2.  */                                \            R##_f[_i] = -1;                                                 \            if (!_i)                                                        \              break;                                                            \            __FP_FRAC_SUB_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0],         \                            Y##_f[2], Y##_f[1], Y##_f[0], 0,                    \                            X##_f[2], X##_f[1], X##_f[0], _n_f[_i]);            \            _FP_FRAC_SUB_4(X, Y, X);                                        \            if (X##_f[3] > Y##_f[3])                                        \              {                                                             \                R##_f[_i] = -2;                                             \                _FP_FRAC_ADD_4(X, Y, X);                                    \              }                                                             \          }                                                                 \        else                                                                \          {                                                                 \            udiv_qrnnd(R##_f[_i], X##_f[3], X##_f[3], X##_f[2], Y##_f[3]);  \            umul_ppppmnnn(_m_f[3], _m_f[2], _m_f[1], _m_f[0],               \                          R##_f[_i], Y##_f[2], Y##_f[1], Y##_f[0]);            \            X##_f[2] = X##_f[1];                                            \            X##_f[1] = X##_f[0];                                            \            X##_f[0] = _n_f[_i];                                            \            if (_FP_FRAC_GT_4(_m, X))                                       \              {                                                             \                R##_f[_i]--;                                                \                _FP_FRAC_ADD_4(X, Y, X);                                    \                if (_FP_FRAC_GE_4(X, Y) && _FP_FRAC_GT_4(_m, X))            \                  {                                                         \                    R##_f[_i]--;                                            \                    _FP_FRAC_ADD_4(X, Y, X);                                    \                  }                                                         \              }                                                             \            _FP_FRAC_DEC_4(X, _m);                                          \            if (!_i)                                                        \              {                                                                    \                if (!_FP_FRAC_EQ_4(X, _m))                                    \                  R##_f[0] |= _FP_WORK_STICKY;                                    \                break;                                                            \              }                                                                    \          }                                                                 \      }                                                                     \  } while (0)/* * Square root algorithms: * We have just one right now, maybe Newton approximation * should be added for those machines where division is fast. */ #define _FP_SQRT_MEAT_4(R, S, T, X, q)                          \  do {                                                          \    while (q)                                                   \      {                                                         \        T##_f[3] = S##_f[3] + q;                                \        if (T##_f[3] <= X##_f[3])                                \          {                                                        \            S##_f[3] = T##_f[3] + q;                                \            X##_f[3] -= T##_f[3];                                \            R##_f[3] += q;                                        \          }                                                        \        _FP_FRAC_SLL_4(X, 1);                                        \        q >>= 1;                                                \      }                                                         \    q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1);                 \    while (q)                       &nbsp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -