Home | Develop | Download | Contact
testprograma.c
1 /*
2  * testprograma.c
3  *
4  * Copyright 2011 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
29 #include <config.h>
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <pds/pdscn.h>
33 
34 int main(int argc, char** argv)
35 {
36  PdsComplex a,b,c;
37  PdsComplex d={3,4}; /* d=3.0+4.0 i */
38 
39  /* a=1.5+2.0 i */
40  a=PDS_CRECT(1.5,2.0);
41 
42  /* b=3.0-1.0 i */
43  b=PDS_CRECT(3.0,-1.0);
44 
45  /* c=a*b */
46  c=PDS_CMULC(a,b);
47 
48  /* Showing results */
49  printf(" a:\t%f+%fi\n",a.Real,a.Imag);
50  printf(" b:\t%f+%fi\n",b.Real,b.Imag);
51  printf("a*b:\t%f+%fi\n",c.Real,c.Imag);
52  printf(" d:\t%f+%fi\n",d.Real,d.Imag);
53 
54  return EXIT_SUCCESS;
55 }
La estructura tipo PdsComplex . Esta estructura genera unnumero complejo. Para usar incluir pdscomple...
Definition: pdscomplex.h:51
PdsCnReal Imag
Definition: pdscomplex.h:56
#define PDS_CRECT(A, B)
Es equivalente a (A+Bi).
Definition: pdscomplex.h:65
PdsCnReal Real
Definition: pdscomplex.h:54
#define PDS_CMULC(A, B)
Es equivalente a (A*B).
Definition: pdscomplex.h:201

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed