Error in square root for cpp_dec_float_100
まだ誰も着手していません。
評価
調査の方向性
提供された再現コードと、boost/multiprecision/cpp_dec_float.hpp によって公開されている sqrt の経路から始め、Boost 1.71.0 および 1.79.0/1.80.0 と動作を比較します。sqrt(49) がゼロでない最終桁を生成する理由を追跡します。再現コードが 7 と等しく比較され、期待される値を出力すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I recently updated boost from 1.71.0 to 1.80.0 and I started getting an error. After some investigation the problem arises from an incorrect rounding on the square root of 49 that makes it 7.000...01 instead of just 7. Here's the code that shows the issue
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <iostream>
using boost::multiprecision::cpp_dec_float_100;
using std::string;
int main() {
cpp_dec_float_100 n(49);
n = sqrt(n);
if (n == (uint32_t) n)
std::cout << "This should be logged as sqrt(49) = 7" << std::endl;
else
std::cout << "Error: sqrt(49) != 7" << std::endl;
std::cout << std::endl << n.str() << std::endl;
return 0;
}
Error: sqrt(49) != 7
7.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
I also replicated the issue here with version 1.79.0. In version 1.71.0 the calculation was correct.
- 主要言語
- C++
- スター
- 268
- フォーク
- 130
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/multiprecision のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
boostorg/multiprecision#779 · コメント 1 件 ·
-
cpp_bin_float fma rounds the product before the addition instead of fusing対応中かも @NAThompson が 43 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
boostorg/multiprecision#777 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
boostorg/multiprecision#775 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
boostorg/multiprecision#768 · コメント 4 件 ·
-
Eigen NumTraits specialisation doesn't define max_digits10()対応中かも @trestoncuzzort が 28 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
boostorg/multiprecision#744 ·
boostorg/multiprecision の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
sav-oss-org/ptusa_main#1610 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
open-astro/AlpacaBridge#2606 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Refactor force_torque_system integration test to use EcmScope対応中かも @patelshivani2283-lab が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Niko1221/Strata#6731 · コメント 2 件 ·
メンテナーはふだん 6 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100