Programowanie w systemie UNIX/ARB: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
m →git: flint-arb |
m →liczby zespolone: nowy kod |
||
Linia 97:
<source lang = c>
/*
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
gcc
./a.out
*/
#include
#include <acb.h> // acb_t
int main()
{
acb_t z;
acb_init(z);
acb_t r;
acb_init(r);
acb_sqrt(r,z, 10); // r=sqrt(z) with precision
▲ acb_set_ui(z, 1);
flint_printf("\n");
mpfr_printf(" MPFR-%s \n GMP-%s \n", mpfr_version, gmp_version );▼
▲
acb_clear(z);
acb_clear(r);
}
Linia 127 ⟶ 134:
Kompiluj:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
gcc a.c -larb -lflint -lgmp -lmpfr -lpthread -Wall
uruchom:
Linia 134 ⟶ 142:
wynik:
sqrt(z) = ((281 * 2^-8) +/- (593337151 * 2^-38), (233 * 2^-9) +/- (630453476 * 2^-40))
Computed with:
arb-2.
GMP-6.1.1
==complex_plot==
|