6

Boost::multiprecision::sqrt(1) が 0 を返すようです

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/number.hpp>
#include <iostream>

using std::cout;
using std::endl;

int main() {
   namespace mp = boost::multiprecision;
   mp::cpp_int i(1); 
   cout << "i == " << i << endl;
   cout << "mp::sqrt(i) == " << mp::sqrt(i) << endl;
}

出力:
i == 1
mp::sqrt(i) == 0

sqrt(1) == 1 になると思います。

coliruと、gcc と Boost 1.62 を使用したローカル インストールで同じ結果が得られます。これは他の人にも起こりますか?何か不足していますか、それともバグですか?

4

1 に答える 1

5

はい、これは間違いなくバグです。チケット #12559として 3 日前に Boost バグトラッカーに報告されました。

于 2016-10-30T21:09:30.327 に答える