Programowanie w systemie UNIX/ARB: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
m →arb_sqrt: _printf("Computed with: \narb-%s\n Flint-%s\n MPFR-%s \n GMP-%s \n", arb_version, FLINT_VERSION ,mpfr_version, gmp_version ); // |
m →arb_sqrt: formatted with emacs |
||
Linia 68:
/*
original file :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/▼
This file is public domain. Author: Fredrik Johansson.
gcc s.c -larb -lflint -lgmp -lmpfr -lpthread -Wall▼
https://raw.githubusercontent.com/fredrik-johansson/arb/master/examples/logistic.c
./a.out▼
-----------------▼
relative determinate error in the square root of Q is one half the relative determinate error in Q▼
▲ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
IEEE-754 standard guarantees me that the result will be as close to the 'real result' as possible, i.e. error will be less than or equal to 1/2 unit-in-the-last-place. In particular,▼
▲ gcc s.c -larb -lflint -lgmp -lmpfr -lpthread -Wall
http://stackoverflow.com/questions/22259537/guaranteed-precision-of-sqrt-function-in-c-c▼
▲ ./a.out
=====================▼
decimal digits required = ceil(-log10(sqrt(x+1)-sqrt(x)))▼
http://stackoverflow.com/questions/30029410/sqrt-and-decimals▼
./a.out
============▼
https://groups.google.com/forum/#!topic/flint-devel/yrOCnfi6DuI▼
▲ -----------------
▲ relative determinate error in the square root of Q is one half the relative determinate error in Q
▲
▲ =====================
I thought that the number will be decreasing but will be greater then 1.0 ( not equal to 1.0)
Correct.
and I will display such number ( all digits )
Note that the ball radius in most of your results is larger than the first nonzero digit after the 1.
For example,
In your calculation, you kept the precision at 64 bits for too long. Then you started doubling the precision unnecessarily. Try increasing the precision by 1 bit on every iteration, right from the start, instead of doubling it after the digits of interest are already gone.
Bill Hart
*/
Linia 90 ⟶ 120:
int main()
{
arb_init(z); ▲ bits = arb_bits(z);
while (1)
{
▲ while (1)
arb_printn(z, dec_digits,
flint_printf("\n");
▲ flint_printf("i = %3wd; prec = %10wd; bits = %10wd; dec_digits = %10wd; z = ", i, prec, bits, dec_digits);
prec += 1;
▲ prec += 1; // "if I have the number 1.000123456.... with a ball radius of 1e-2, I will only see 1.00+/-1e-2. If I have a ball radius of 1e-5, I'll see 1.00012+/-1e-5." Bill Hart
dec_digits = (prec-3)/3.3219280948873623; //
i+=1; printf("Computed with: \narb-%s\n Flint-%s\n MPFR-%s \n GMP-%s \n", arb_version, FLINT_VERSION ,mpfr_version, gmp_version ); //▼
flint_cleanup();▼
return 0;▼
▲
arb_clear(z);
}
</source>
|