Home
|
Develop
|
Download
|
Contact
Página principal
Páginas relacionadas
Módulos
Estructuras de Datos
Ejemplos
testprograma.c
Programa para el testeo de operaciones con números complejos.
Autor
Fernando Pujaico Rivera
Fecha
01-05-2015
/*
* testprograma.c
*
* Copyright 2011 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <pds/pdscn.h>
int
main(
int
argc,
char
** argv)
{
PdsComplex
a,b,c;
PdsComplex
d={3,4};
/* d=3.0+4.0 i */
/* a=1.5+2.0 i */
a=
PDS_CRECT
(1.5,2.0);
/* b=3.0-1.0 i */
b=
PDS_CRECT
(3.0,-1.0);
/* c=a*b */
c=
PDS_CMULC
(a,b);
/* Showing results */
printf(
" a:\t%f+%fi\n"
,a.
Real
,a.
Imag
);
printf(
" b:\t%f+%fi\n"
,b.
Real
,b.
Imag
);
printf(
"a*b:\t%f+%fi\n"
,c.
Real
,c.
Imag
);
printf(
" d:\t%f+%fi\n"
,d.
Real
,d.
Imag
);
return
EXIT_SUCCESS;
}
Enlaces de interés
Manual de referencia generado el Miércoles, 7 de Septiembre de 2016 22:20:38 para la biblioteca
PdsComplexNumbers
usando Generado el Miércoles, 7 de Septiembre de 2016 22:20:38 para PdsComplexNumbers por
1.8.11