Programowanie w systemie UNIX/MPC: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
→‎Instalacja: synapotic
→‎asin(2i): nowy kod
Linia 108:
 
/*
 
https://www.gnu.org/ghm/2011/paris/slides/andreas-enge-mpc.pdf
 
gcc a.c -lmpc -lmpfr -lgmp
 
./a.out
*/
 
 
 
Linia 120:
#include <mpfr.h>
#include <mpc.h>
 
int main (void) {
 
mpc_t z; // input value = op
int inex; // return value of the function ( not the result of computation )
int inex;
mpc_t r; // output value = rop : r=f(z)
 
 
mpc_init2 (z, 123);
mpc_init2 (r, 123);
 
 
mpc_set_ui_ui (z, 0, 2, MPC_RNDNN); // z = 0 + 2i
 
// int mpc_asin (mpc_t rop, mpc_t op, mpc_rnd_t rnd)
 
// Set rop to the inverse sine of op, rounded according to rnd with the precision of rop
inex = mpc_asin (zr, z, MPC_RNDNN);
 
 
printf ("asin");
mpc_out_str (stdout, 10, 0, z, MPC_RNDNN);
printf ("\n%i %i\n= ", MPC_INEX_RE (inex), MPC_INEX_IM (inex));
mpc_out_str (stdout, 10, 0, r, MPC_RNDNN);
 
printf (" \n");
 
printf ("inex = %i %i\n", MPC_INEX_RE (inex), MPC_INEX_IM (inex));
mpc_clear (z);
mpc_clear (z);
mpc_clear(r);
}
 
</source>
 
Linia 148 ⟶ 154:
 
 
asin(0 2.00000000000000000000000000000000000000) = (0 1.44363547517881034249327674027310526938)
inex = 0 -1
 
==Źródła==