-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
Description
The following code will print about 21'000 digits (which is what you expect given precision 70'000 and given that one decimal digits is about 3.3 binary digits).
from bigfloat import *
print(sqrt(2, precision(70000)))However, from those digits only about the first 5'000 digits are correct. And the last 5'000 digits are all zeros.
Increasing the precision will not change the result, it will just add more zeros at the end.
This clearly looks like a bug to me. I wrote the same thing in C++ (using MPFR C++), and there I get the correct digits. The first 20'000 of them are correct (comparing to https://oeis.org/A002193/b002193.txt).
#include <iostream>
#include "mpreal.h"
int main() {
using mpfr::mpreal;
mpreal::set_default_prec(70'000);
std::cout.precision(20'000);
std::cout << mpfr::sqrt(2) << std::endl;
}